ÕÕ×ÅÊéÉÏдµÄ£¬Ö´ÐÐʱ±¨´í£¨Python2.6£©
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)
button = wx.Button(panel,label="Close",pos=(125,20),
size=(50,50))
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.Destroy()
if __name__=='__main__':
app = wx.PySimpleApp()
frame = InsertFrame(parent=None,id=-1)
frame.Show()
app.MainLoop()
±¨´íÐÅÏ¢ÈçÏ£º
Traceback (most recent call last):
File "D:\Python26\test\wx\button.py", line 19, in <module>
frame = InsertFrame(parent=None,id=-1)
File "D:\Python26\test\wx\button.py", line 4, in __init__
wx.Frame.__init__(self,parent,id,'
RT£¬Ã²ËÆPythonÖ®¸¸Ò²ËµÈç¹ûÄãÏÖÔÚ¿ªÊ¼ÐµÄÏîÄ¿µÄ»°£¬×îºÃÊÇÖ±½ÓʹÓÃPython3£¬¿ÉÊÇʵ¼ÊÉÏ´ó¼ÒʹÓõô󲿷ֻ¹ÊÇ2.5£¬¹À¼ÆÓÃ2.6µÄ¶¼²»ÊǺܶ࣬²¢ÇÒÏà¶ÔÓ¦µÄÐí¶àÀ©Õ¹¶¼Ã»ÓÐ3¶ÔÓ¦µÄ°æ±¾¡£
  ......