Brian Rowlands (Greymouth High School)
RowlandsB at greyhigh.school.nz
Sun Jun 27 15:52:37 MDT 2010
New to both Wing IDE and Python and busily trying to get my head around
threads when I tried a simple example off the WWW.
It falls over in Wing IDE but the author assures me it works fine when
he tested it after I wrote to him. He had someone else test it and it
worked too on a windows platform ( which is what I'm using).
Wind IDE Personal doesn't report any errors.
Am I allowed to ask if someone could test it via their IDE and let me
know the results please?
If so, code is shown below.
#-*- coding:utf-8 -*-
# By Chris Oliver <chris at excid3.com>
# Adapted from
Initializes the GTK application, in our case, create the
and other widgets
# Create a window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Setup the application to exit GTK when the window is closed
# Create a button
self.button = gtk.Button("Hello World")
# Make the button call self.hello() when it is clicked
# Add the button into the window
# Display the button and the window
def hello(self, widget, data=None):
def hello_helper(self, widget, data=None):
print "starting new thread"
threading.Thread(target=self.hello, args=(widget, data)).start()
This function starts GTK drawing the GUI and responding to
like button clicks
def destroy(self, widget, data=None):
This function exits the application when the window is
Without this the GTK main thread would continue running
interface would be displayed. We want the application to
the window is closed, so we tell the GTK loop to stop so we
if __name__ == "__main__":
# Create an instance of our GTK application
app = HelloWorld()
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the wingide-users