我的弹出窗口在当前打开的窗口后面打开,所以看不到弹出窗口。如何在当前打开的窗口顶部显示弹出窗口?以下是示例代码:
import PySimpleGUI as sg
# set global options for window
background = '#F0F0F0'
sg.SetOptions(background_color=background,
element_background_color=background,
text_element_background_color=background,
window_location=(0, 0),
margins=(0,0),
text_color = 'Black',
input_text_color ='Black',
button_color = ('Black', 'gainsboro'))
layout = [[sg.Button('Ok'), sg.Button('Cancel')]]
window = sg.Window('Test Window', grab_anywhere=False, size=(800, 480), return_keyboard_events=True, keep_on_top=True).Layout(layout).Finalize()
window.Maximize();
while True:
event, values = window.read()
if event in (None, 'Cancel'):
break
else:
sg.Popup('Ok clicked')
我尝试使用 keep_on_top=True 弹出弹出窗口,但它不起作用,窗口优先显示在顶部,因此弹出窗口仍然隐藏在窗口后面。有没有办法在窗口上方显示弹出窗口?