Python 如何在PYsimpleGUI中调整sg.window的大小?
我在python代码中使用PYsimpleGUI,在使用window元素创建主窗口时,这是我的代码 我的代码:Python 如何在PYsimpleGUI中调整sg.window的大小?,python,pip,pysimplegui,Python,Pip,Pysimplegui,我在python代码中使用PYsimpleGUI,在使用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
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()
我注意到,当我运行这个程序时,当窗口自身调整大小并变小时,整个标题不会显示出来
有没有办法调整sg.window的大小?您可以在
sg.window
中添加size参数
试试这个:
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()
很好用!