[pygtk] Getting widget visibility
Mitko Haralanov
mitko at qlogic.com
Thu Apr 24 01:23:58 WST 2008
On Wed, 23 Apr 2008 14:10:10 -0300
"Facundo Batista" <facundobatista at gmail.com> wrote:
> If you could provide an example that makes this to you, for us to try
> it, we could help you better.
Here you go:
#!/usr/bin/python
import gtk
import pygtk
def toggle_func (widget, *user_data):
frame = user_data[0]
if frame.visible:
frame.hide ()
else:
frame.show ()
window = gtk.Window ()
vbox = gtk.VBox ()
button = gtk.Button ("Toggle")
frame = gtk.Frame ("Test Frame")
label = gtk.Label ("Some Text")
frame.add (label)
vbox.pack_start (frame)
vbox.pack_start (button)
window.add (vbox)
button.connect ("clicked", toggle_func, frame)
window.connect ("delete-event", gtk.main_quit)
window.show_all ()
gtk.main ()
# ./test.py
Traceback (most recent call last):
File "./test.py", line 8, in toggle_func
if frame.visible:
AttributeError: 'gtk.Frame' object has no attribute 'visible'
--
Mitko Haralanov
==========================================
I WILL NOT USE ABBREV.
I WILL NOT USE ABBREV.
I WILL NOT USE ABBREV.
I WILL NOT USE ABBREV.
Bart Simpson on chalkboard in episode 2F33
More information about the pygtk
mailing list