搜尋此網誌

建立一個有按鈕的視窗





import wx

class bucky(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'Frame jackaitw 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()
------------------------------------------------------------------------

只要改變x軸和y軸的數值可將畫面移到中間


參考:http://ithelp.ithome.com.tw/articles/10053095

 

Copyright © Jackie.Chen | Powered by Blogger | Template by 54BLOGGER | Fixed by Free Blogger Templates