Search code examples
pythonwxpython

Minimize a frame with a fixed size in wxPython


I am using wxPython and I want to fix the size of the Frame, so the user can not change it. This code is for a "normal" fcrame:

wx.Frame.__init__(self, None, title=title, pos=(150,150), size=(450,620))

With the code below the user can not change the size of the frame, but I am also losing the possibility of minimizing the window.

wx.Frame.__init__(self, None, title=title, pos=(150,150), size=(450,620), style= wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX)

Does anybody know how can I have a fixed size frame which I can also minimize?


Solution

  • Add wx.MINIMIZE_BOX

    import wx
    
    app = wx.App()
    window = wx.Frame(None, style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX)
    window.Show(True)
    
    app.MainLoop()