]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-01/sample.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-01 / sample.py
1 #!/bin/env python
2 import wx
3
4 class MyFrame(wx.Frame):
5
6 def __init__(self):
7 wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
8 panel = wx.Panel(self, -1)
9 panel.Bind(wx.EVT_MOTION, self.OnMove)
10 wx.StaticText(panel, -1, "Pos:", pos=(10, 12))
11 self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(40, 10))
12
13 def OnMove(self, event):
14 pos = event.GetPosition()
15 self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))
16
17 if __name__ == '__main__':
18 app = wx.PySimpleApp()
19 frame = MyFrame()
20 frame.Show(True)
21 app.MainLoop()