How to resize sg.window in PYsimpleGUI?

27.8k views Asked by At

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?

1

There are 1 answers

0
Bhargav Desai On BEST ANSWER

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()