title: GTK and python. How convert RGBA to HEX?
body: <pre><code>        # a colorbutton (which opens a dialogue window in
          # which we choose a color)
          self.button_err_bg = Gtk.ColorButton()
          # with a default color (blue, in this instance)
          color_bg = Gdk.RGBA()
          color_bg.red = 0.5
          color_bg.green = 0.4
          color_bg.blue = 0.3
          color_bg.alpha = 1.0
          color_error_background = self.button_err_bg.set_rgba(color_bg)
  
          # choosing a color in the dialogue window emits a signal
          self.button_err_bg.connect("color-set", self.on_color_fg_error_chosen)
  </code></pre>
  
  <p>and method</p>
  
  <pre><code>    def on_color_fg_error_chosen(self, user_data):
          print("You chose the color: " + self.button_err_bg.get_rgba().to_string())
          color_rgba = self.button.get_rgba().to_string()
          color_rgba_bracket = color_rgba[color_rgba.find("(")+1:color_rgba.find(")")]
          color_hex = '#{:02x}{:02x}{:02x}'.format(color_rgba_bracket)
          print(color_hex)
  </code></pre>
  
  <p>color_hex :color_hex = '#{:02x}{:02x}{:02x}'.format(color_rgba_bracket)
  ValueError: Unknown format code 'x' for object of type 'str'</p>