用wx.Button创建一个按钮控件
运行效果图:Python代码:#!/usr/bin/env python# -*- encoding:utf-8 -*-'Create Button Example'import wxclass MyFrame(wx.Frame):def __init__(self,parent,id):wx.Frame.__init__(self,par
·
运行效果图:
Python代码:
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
'Create Button Example'
import wx
class MyFrame(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'Create Button',pos=(300,200),size=(300,200))
panel=wx.Panel(self)
button=wx.Button(panel,label='Exit',pos=(120,10),size=(60,60))
self.Bind(wx.EVT_BUTTON,self.closebutton,button)
self.Bind(wx.EVT_CLOSE,self.closewindow)
def closebutton(self,event):
self.Close(True)
def closewindow(self,event):
self.Destroy()
if __name__=='__main__':
app=wx.PySimpleApp()
myframe=MyFrame(parent=None,id=-1)
myframe.Show(True)
app.MainLoop()
更多推荐
已为社区贡献24条内容
所有评论(0)