简体   繁体   中英

How to add wxpython frame style to disable frame resizing

I build a sample program using wxpython and i need to disable frame resizing.

I know i should use wx.Frame style but i don't know where i can add this in my code.

style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER

Code:

class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
        self.AppUI()

    def AppUI(self):

        panel = wx.Panel(self)
        sizer = wx.GridBagSizer(5, 5)
        logo = wx.StaticBitmap(panel, bitmap=wx.Bitmap('./logo.png'))
        sizer.Add(logo, pos=(0, 2), flag=wx.TOP|wx.CENTER|wx.ALIGN_CENTER, border=3)
        line = wx.StaticLine(panel)
        sizer.Add(line, pos=(1, 0), span=(1, 5), flag=wx.EXPAND|wx.BOTTOM, border=10)

        # rest of code ........
        #.....
        #.....


        #app required
        self.SetSize((550, 560))
        self.SetTitle('Example App')
        self.Centre()
        self.SetSizer(sizer)
        self.Show(True)


def main():
    app = wx.App()
    Example(None)
    app.MainLoop()

if __name__ == '__main__':
    main()

I solve my problem by deleting **kwargs from init .

class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN)
        self.AppUI()

        #rest of code....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM