#!/usr/bin/python
# moveevent.py
import wx #导入wx库
class MoveEvent(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(250, 180)) #窗口大小为(250, 180)
wx.StaticText(self, -1, 'x:', (10,10))#parent, id, title, point
wx.StaticText(self, -1, 'y:', (10,30))
self.st1 = wx.StaticText(self, -1, '', (30, 10))
self.st2 = wx.StaticText(self, -1, '', (30, 30))
self.Bind(wx.EVT_MOVE, self.OnMove) #绑定Frame的move事件
self.Centre()
self.Show(True)
def OnMove(self, event):
x, y = event.GetPosition()
self.st1.SetLabel(str(x))
self.st2.SetLabel(str(y))
app = wx.App()#生成应用程序
MoveEvent(None, -1, 'move event')#调用自己的类,三个参数为:parent, id , title
app.MainLoop()#应用程序事件循环
#!/usr/bin/python
# veto.py
import wx
class Veto(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(250, 200))
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.Centre()
self.Show(True)
def OnClose(self, event):
dial = wx.MessageDialog(None, 'Are you sure to quit?', 'Question',
wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
ret = dial.ShowModal()
if ret == wx.ID_YES:
self.Destroy()
else:
event.Veto()
app = wx.App()
Veto(None, -1, 'Veto')
app.MainLoop()
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有