I’m trying to open a tkinter window using PySimpleGUI towards the end of a lengthy program.
def raise_above_all(window):
window.attributes('-topmost', 1)
window.attributes('-topmost', 0)
window = sg.Window('File Selector', layout)
while True: # Event Loop
event, values = window.read()
raise_above_all(window.TKroot)
break
window.close()
When I start a new console the window opens in the backgroud. If I restart the whole program it then opens in the front as it should. If I start a fresh console it again opens in the back. If I just run that section it opens in front.
How can this be? I even added a required input just before the window is supposed to open, thinking that maybe the program running for so long is causing some idle status which is causing the issue, but that didn’t help.
Background thread