任何人都可以帮我弄清楚我做错了什么我对GUI几乎没有经验。代码:
import wx
class bucky(wx.Frame):
#constructor
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'Frame aka window',size=(300,200))
panel=wx.Panel(self)
button=wx.Button(panel,label="exit",pos=(130,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()
frame=bucky(parent=None,id=-1)
frame.Show()
app.MainLoop()
错误:
PyNoAppError: The wx.App object must be created first!
win32ui.error: Error in Command Message handler for command ID 36864, Code 0