Issue
I have an application that uses PySimpleGUI for its UI. The application runs on a rasbperry pi and uses the pi touchscreen as a display. When the application starts, it fills the pi display. There are some instances where I need to prompt the user with a dialog, but I'm having some issues with the dialog not staying on top. I tried something very simple, as soon as the window is created I show a dialog box. If the user accidentally touches anywhere on the window behind the dialog, then that window gets focus and the dialog box is now behind it. There is no keyboard attached, this is all touch, so they can't get the dialog back by using a keyboard to cycle windows.
__window = Gui.Window("Imaging System",
tabbed_layout,
no_titlebar=True,
location=(0, 0),
size=(800, 480),
finalize=True)
__window[constants.KEY_OUTPUT_BUFFER].expand(True, True, True)
__window.maximize()
Gui.popup_error('test', modal=True, keep_on_top=True)
I tried setting grab_anywhere=False
on the main window, but it did not seem to have any effect as touching the main window still sends the dialog behind it.
I'm using Python version 3.9.2 and PySimpleGUI version 4.60.4
Solution
This turns out to be a bug in PySimpleGUI, but it only exhibits itself when used in conjunction with no_titlebar=True
. Removing the no_titlebar
option allows the popups to function correctly and stay on top.
Details can be found here
Answered By - lane.maxwell Answer Checked By - David Goodson (WPSolving Volunteer)