wxpython learning - basic framework

import wx

class MyApp(wx.App):
    def __init__(self):
        super(MyApp,self).__init__()

class MyFrame(wx.Frame):
    def __init__(self,title='test',size=wx.DefaultSize):
        super(MyFrame,self).__init__(None,wx.ID_ANY,title=title,size=size,style=wx.DEFAULT_FRAME_STYLE^wx.MINIMIZE_BOX)
        self.Center()
        #self.SetSize(700,700)
        #self.SetTitle('aaa')

if __name__ == '__main__':
    app = MyApp()
    frame = MyFrame(title='wx-test',size=(400,300))
    frame.Show()
    app.MainLoop()

After running:

 

 

 

Frame:
None: i.e., parent = None, represented by the topmost window
wx.ID_ANY: when the id value of -1 or wx.ID_ANY, the system will randomly assign a id
style: style, wx.DEFAULT_FRANME_STYLE values: wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX, increases with a style '|', removing a pattern with '^', for example, the window size can be adjusted prohibit wx.DEFAULT_FRANME_STYLE ^ wx. RESIZE_BORDER

Guess you like

Origin www.cnblogs.com/xia-dong/p/11607883.html