#coding=utf-8
#wxPython 学习
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self,None,-1,"MyFrame",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,evnet):
pos = evnet.GetPosition()
self.posCtrl.SetValue("%s,%s"%(pos.x,pos.y))
if __name__== '__main__':
app = wx.PySimpleApp()
frame = MyFrame()
frame.Show(True)
app.MainLoop()
#! /usr/bin/env python
#coding=utf-8
import wx
class App(wx.App):
def OnInit(self):
frame = wx.Frame(parent=None,title="Bare")
frame.Show()
return True
app = App()
app.MainLoop()
阅读(475) | 评论(0) | 转发(0) |