아무도 내가 잘못하고있는 것을 알아낼 수 있습니까? GUI에 대한 경험이 거의 없습니다. 코드 :Python, wxPython 오류
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
코드의 들여 쓰기를 수정하여 텍스트 편집기에서 모든 모양이 들여 쓰기되도록하십시오. 파이썬에서는 매우 중요합니다. – Marius
제 3의 인자가 필요 없다고 생각합니다. self.Bind (wx.EVT_BUTTON, self.closebutton, button)' –
완전한 추적입니까? 그 오류가 어떤 줄에서 왔는지 알려주 죠? – Blair