]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-02/startup.py
fixed deadlock when calling wxPostEvent() from worker thread
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-02 / startup.py
1 #!/usr/bin/env python
2
3 import wx
4 import sys
5
6 class Frame(wx.Frame):
7
8 def __init__(self, parent, id, title):
9 print "Frame __init__"
10 wx.Frame.__init__(self, parent, id, title)
11
12 class App(wx.App):
13
14 def __init__(self, redirect=True, filename=None):
15 print "App __init__"
16 wx.App.__init__(self, redirect, filename)
17
18 def OnInit(self):
19 print "OnInit"
20 self.frame = Frame(parent=None, id=-1, title='Startup')
21 self.frame.Show()
22 self.SetTopWindow(self.frame)
23 print >> sys.stderr, "A pretend error message"
24 print "app name: <", self.GetVendorName(), ">"
25 return True
26
27 def OnExit(self):
28 print "OnExit"
29
30 if __name__ == '__main__':
31 app = App(redirect=True)
32 print "before MainLoop"
33 fred = app.MainLoop()
34 print "after MainLoop", fred
35