【发布时间】:2021-02-26 03:42:39
【问题描述】:
如何在 PySimpleGUI 中调整窗口大小时收到通知?
我有一个启用调整大小事件的窗口,但我没有找到在调整大小发生时移动元素的方法,所以当窗口改变大小时,我的窗口重命名为左上角居中相同的大小。
这是基本代码:
import PySimpleGUI as sg
layout = [[sg.Button('Save')]]
window = sg.Window('Window Title',
layout,
default_element_size=(12, 1),
resizable=True) # this is the change
while True:
event, values = window.read()
if event == 'Save':
print('clicked save')
if event == sg.WIN_MAXIMIZED: # I just made this up, and it does not work. :)
window.maximize()
if event == sg.WIN_CLOSED:
break
【问题讨论】:
标签: python pysimplegui