]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-06/example3.py
fixed deadlock when calling wxPostEvent() from worker thread
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-06 / example3.py
1 import wx
2 from example1 import SketchWindow
3
4 class SketchFrame(wx.Frame):
5 def __init__(self, parent):
6 wx.Frame.__init__(self, parent, -1, "Sketch Frame",
7 size=(800,600))
8 self.sketch = SketchWindow(self, -1)
9 self.sketch.Bind(wx.EVT_MOTION, self.OnSketchMotion)
10 self.statusbar = self.CreateStatusBar()
11 self.statusbar.SetFieldsCount(3)
12 self.statusbar.SetStatusWidths([-1, -2, -3])
13
14 def OnSketchMotion(self, event):
15 self.statusbar.SetStatusText("Pos: %s" %
16 str(event.GetPositionTuple()), 0)
17 self.statusbar.SetStatusText("Current Pts: %s" %
18 len(self.sketch.curLine), 1)
19 self.statusbar.SetStatusText("Line Count: %s" %
20 len(self.sketch.lines), 2)
21 event.Skip()
22
23 if __name__ == '__main__':
24 app = wx.PySimpleApp()
25 frame = SketchFrame(None)
26 frame.Show(True)
27 app.MainLoop()