如何在 PYsimpleGUI 中调整 sg.window 的大小?
How to resize sg.window in PYsimpleGUI?
我在我的 python 代码中使用 PYsimpleGUI,并且在使用 window 元素创建主 window 时,这是我的代码。
我的代码:
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()
我注意到当我 运行 这个程序时,没有显示完整的标题,因为 window 会自行调整大小并变小。
有没有办法调整大小 sg.window?
您可以在 sg.Window
中添加尺寸参数。
试试这个:
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()
我在我的 python 代码中使用 PYsimpleGUI,并且在使用 window 元素创建主 window 时,这是我的代码。
我的代码:
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()
我注意到当我 运行 这个程序时,没有显示完整的标题,因为 window 会自行调整大小并变小。
有没有办法调整大小 sg.window?
您可以在 sg.Window
中添加尺寸参数。
试试这个:
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()