Added the sample code from wxPython In Action to the samples dir
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
21
wxPython/samples/wxPIA_book/Chapter-01/sample.py
Normal file
21
wxPython/samples/wxPIA_book/Chapter-01/sample.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/env python
|
||||
import wx
|
||||
|
||||
class MyFrame(wx.Frame):
|
||||
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
|
||||
panel = wx.Panel(self, -1)
|
||||
panel.Bind(wx.EVT_MOTION, self.OnMove)
|
||||
wx.StaticText(panel, -1, "Pos:", pos=(10, 12))
|
||||
self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(40, 10))
|
||||
|
||||
def OnMove(self, event):
|
||||
pos = event.GetPosition()
|
||||
self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = wx.PySimpleApp()
|
||||
frame = MyFrame()
|
||||
frame.Show(True)
|
||||
app.MainLoop()
|
Reference in New Issue
Block a user