I've inserted a gtk.ColorButton() but when I retrieve the value (get_color) I obtain a 12 digits hex string (for certain colors). The problem is that I need it to give me only 6 digits.
Here's a snippet :
import pygtk
pygtk.require("2.0")
import gtk
class TestColorButton(object):
def __init__(self):
self.win = gtk.Window()
self.colorbutton = gtk.ColorButton()
container = gtk.VBox()
Button = gtk.Button("Get color")
Button.connect("released", self.get_selected_color)
container.pack_start(self.colorbutton)
container.pack_start(Button)
self.win.add(container)
self.win.show_all()
def get_selected_color(self, widget):
print self.colorbutton.get_color()
if __name__ == "__main__":
TestColorButton()
gtk.main()
I don't know if the only solution would be to try to convert the 12 digits hex string to a 6 digits one (even though I would be losing information). Since nothing in python can use a 12 digits color I'm seriously wondering what was the use of this...
The funny part is that in the window that pops up I can see a 6 digits hex string. Maybe if I can get_childs that window until I find it... but it seems complicated for a simple matter...