Hi, I just started programming in python and using glade to build my Gui, for the time being in gtk2 as gtk3 gives me numerous errors which shouldn't occur (even I can judge that from my basic sckills). I wrote some command line python scripts some years ago so I'm not a complete beginner, but I am with regard to glade and gtk.
I create a gtk2 gui in glade with a number of elements. One of these elements is a gtkcombobox offering you the option to set the outputto jpg, tiff or png, where jpg is the default.
If jpeg is selected only a spinbutton with jpeg compression is displayed.
if tiff is selected only a combobox with tiff compression options is displayed
if png is selected there is no further selection.
This is handled in the following code:
Code:
def on_cb_imageformats_changed(self, combo ):
# Which image format did we select
value = combo.get_active_text()
print "selected output format: " + value
if value == "JPEG":
self.lbl_tiffcompression.hide()
self.cb_tiffcompression.hide()
self.lbl_jpegcompression.show()
self.spinbutton_jpegcompression.show()
elif value == "TIFF":
self.lbl_tiffcompression.show()
self.lbl_jpegcompression.hide()
self.cb_tiffcompression.show()
self.spinbutton_jpegcompression.hide()
else: #PNG
self.lbl_jpegcompression.hide()
self.lbl_tiffcompression.hide()
self.cb_tiffcompression.hide()
self.spinbutton_jpegcompression.hide()
This works fine. However, as jpeg is the default I want to hide the tiff label and combobox on startup.
At the end of the "def __init__( self ):" routine I use the same code for my tiff label and combobox with a print statement to see whether it gets there and whether it gets executed
Code:
print "And now we hide our tiff elements"
self.lbl_tiffcompression.hide()
self.cb_tiffcompression.hide()
It writes the print statement but doesn't execute the hide commands and gives no error either. What am I doing wrong?
Note: If I switch the sensitivity (enabled/disabled) in glade the element gets disabled but I can't enable it anymore from the code. If I set the visibility in glade (hide/show) it has no influence at all.
Again: Am I doing something wrong or is this maybe a bug?
Ubuntu 12.04 64bits
glade 3.8.0
python 2.7.3 (although 3.2 is also installed as a dependency for blender)
python-gtk2 2.24.0-3