AFarris01
August 19th, 2009, 06:31 PM
Hey everybody! I'm trying to break into GUI programming w/ Python, and I'm having issues.
I've been trying to follow this tutorial:http://handhelds.org/~nelson/pyglade/pyglade-tutorial to figure out how to mash python and Glade together to make a nice GUI program, but I can't get the example program to work right. I searched around for a few hours, got it to finally execute w/o errors, but no display ever comes up. Here's my current python code (glade file is attached):
#!/usr/bin/env python
import gtk, gtk.glade
# From example: wrapper class for widget event handlers
class GladeHandlers:
pass
#wrapper class for the widget tree
class WidgetsWrapper:
def __init__(self):
self.widgets = gtk.glade.XML ('pyglade2.glade', "root_window")
self.widgets.signal_autoconnect(GladeHandlers.__di ct__)
# From Example: Adds the ability to do: widgets['widget_name'].action()
# for the 'GladeHandelers class
def __getitem__(self, key):
return self.widgets.get_widget(key)
# assign the widget tree
widgets = WidgetsWrapper()
# start GTK
gtk.main()
At this point, the tutorial claims that a window should pop up, but of course for me, the python code runs w/o error, but a window never appears.
Anybody with some python/Glade experience be able to help?*id greatly appreciate it. :)
I've been trying to follow this tutorial:http://handhelds.org/~nelson/pyglade/pyglade-tutorial to figure out how to mash python and Glade together to make a nice GUI program, but I can't get the example program to work right. I searched around for a few hours, got it to finally execute w/o errors, but no display ever comes up. Here's my current python code (glade file is attached):
#!/usr/bin/env python
import gtk, gtk.glade
# From example: wrapper class for widget event handlers
class GladeHandlers:
pass
#wrapper class for the widget tree
class WidgetsWrapper:
def __init__(self):
self.widgets = gtk.glade.XML ('pyglade2.glade', "root_window")
self.widgets.signal_autoconnect(GladeHandlers.__di ct__)
# From Example: Adds the ability to do: widgets['widget_name'].action()
# for the 'GladeHandelers class
def __getitem__(self, key):
return self.widgets.get_widget(key)
# assign the widget tree
widgets = WidgetsWrapper()
# start GTK
gtk.main()
At this point, the tutorial claims that a window should pop up, but of course for me, the python code runs w/o error, but a window never appears.
Anybody with some python/Glade experience be able to help?*id greatly appreciate it. :)