How to resize sg.window in PYsimpleGUI?

12,589

You can add size argument in the sg.Window.

Try this :

import PySimpleGUI as sg

layout = [ [sg.Button('Close')] ]

window = sg.Window('This is a long heading.', layout,size=(290, 50))
while True:
    event, values = window.read()
    if event == sg.WIN_CLOSED or event == 'Close':
        break
    break
window.close()
Share:
12,589

Related videos on Youtube

Ameya Uppina
Author by

Ameya Uppina

Love Coding <3

Updated on June 04, 2022

Comments

  • Ameya Uppina
    Ameya Uppina almost 2 years

    I am using PYsimpleGUI in my python code, and while using the window element to create the main window, this is my code.

    My code:

    import PySimpleGUI as sg
    
    layout = [ [sg.Button('Close')] ]
    
    window = sg.Window('This is a long heading.', layout)
    while True:
        event, values = window.read()
        if event == sg.WIN_CLOSED or event == 'Close':
            break
        break
    window.close()
    

    I notice that when I run this program, the full heading is not shown as the window resizes itself and becomes small.

    Is there a way to resize sg.window?