Home>
I want to achieve

In style for full screen displaywx.MAXIMIZEI entered, but it is not displayed properly.

Something is displayed in the upper right, and the rest is gray and nothing.

Source code
import wx
class MyFrame (wx.Frame):
    def __init __ (self):
        wx.Frame.__init__ (self, None, -1, "a", style = wx.MAXIMIZE)
        p = wx.Panel (self, -1)
        l = wx.StaticText (p, -1, "aiueo")
app = wx.App (False)
f = MyFrame ()
f.Show (True)
app.MainLoop ()
environment

Windows 10
Python3.8
64bit

  • Answer # 1

    The window style is "bit flag", so
    Usually in combination with the default style wx.DEFAULT_FRAME_STYLE
    Specify on/off for bit operations.

    It is easy to understand if it is written in binary.

    https://wxpython.org/Phoenix/docs/html/wx.Frame.html

    wx.DEFAULT_FRAME_STYLE: Defined as wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN.

    style = wx.MAXIMIZEThen, other flags are not applied.

    To add a flag

    style = wx.DEFAULT_FRAME_STYLE | wx.MAXIMIZE

    By the way, MAZMIMIZE specifies the frame "size at initialization",
    The documentation states that it is valid only for GTK +/Window.

    Solution: To maximize the window ...

    Maximize method to maximize the window,

    There is a ShowFullScreen method to make it full screen.


    For problems where the layout is not displayed as expected, apart from the maximization specification,
    The direct cause is that the size of the Panel is unspecified.
    The text placed in it is cut off.

    Specify the size for Panel or
    Using parts that manage the layout, such as BoxSizer,
    Let's adjust the size and layout automatically.

    # XXX: The same phenomenon can be reproduced without specifying style = MAXIMIZE.
            p = wx.Panel (self, -1)
            p2 = wx.Panel (p, -1)
            l = wx.StaticText (p2, -1, "aiueo")

    With style = wx.MAXIMIZE specified when creating a frame,
    At initialization (At the time of __init__) To specify the size
    Resizing is not notified to each widget after placing the widgets.

    If you want to maximize using the Maximize () method
    Since the size change is notified to the small widget, it will be displayed normally.