Search code examples
pythonuser-interfacefiremonkeymaximize-window

Initialize Form as Maximized in a Python FMX GUI App


I'm making an app in the DelphiFMX GUI Library for Python. I have a Form that is being created, but it's being created as a normal window. How do I create and maximize it immediately? It should start as maximized.

This is my current code:

from delphifmx import *

class frmMain(Form):
    def __init__(self, owner):
        self.Caption = 'My Form'
        self.Width = 600
        self.Height = 500

def main():
    Application.Initialize()
    Application.Title = "My Application"
    Application.MainForm = frmMain(Application)
    Application.MainForm.Show()
    Application.Run()
    Application.MainForm.Destroy()

main()

Is there a property or function I can use?


Solution

  • Use the WindowState property on the Form like so:

    self.WindowState = "wsMaximized"
    

    This will initialize the app as Maximized. The default value for WindowState is wsNormal.

    There's also wsMinimized to start the app as Minimized.