37,719
社区成员
发帖
与我相关
我的任务
分享
import wx
class InsertFrame(wx.Frame):
def __Init__(self,parent,id):
wx.Frame.__Init__(self,parent,id,'Frame With Button',size=(300,100))
panel=wx.Panel(self) #create panel
button=wx.Button(panel,label="Close",pos=(125,50),size=(150,150))
self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button)
self.Bind(wx.EVT_CLOSE,self.OnCloseWindow)
def onCloseMe(self,event):
self.Close(True)
def OnCloseWindow(self,event):
self.Destory()
'''class App(wx.App):
def onInit(self):
frame=InsertFrame(parent,id=-1)
frame.Show()
self.SetTopWindow(self.frame)
return True'''
if __name__=='__main__':
app=wx.App()
frmae=InsertFrame(parent=None,id=-1)
frmae.Show()
app.MainLoop()