I've created an application to run a query and download some files from a database. I want to indicate the application is still running while the query resolves. Currently, the loading animation popup appears over the main window. However, when I minimize the main window, the popup remains. I want to popup to appear, disappear (minimize), and move relative to the main window.
I have not delved into the Tkinter documentation yet. I'm not sure how it would interact with PySimpleGUI. I'm hoping to just use PySimpleGUI, but I am open to other solutions.
I'd like to also use the modal functionality for it. The main window shouldn't support interaction while the download script is running.
import PySimpleGUI as psg
def download_thread():
pass
psg.theme('GrayGrayGray')
layout = [
[psg.Frame("Query",[
[psg.Button('Open File'), psg.Button('Save File'), psg.Text('Untitled.sql', key = '-DOCNAME-')],
[psg.Multiline(size = (120,30), key = '-TEXTBOX-', font='Consolas 12', no_scrollbar=True, expand_x=True)],
])],
[psg.Column([[psg.Button('Download Files'),psg.Cancel()]], justification='right')]
]
window = psg.Window('File Download Tool', layout)
loading = False
while True:
event, values = window.read(timeout = 10)
if event == psg.WIN_CLOSED or event == 'Exit':
break
if loading:
psg.popup_animated(psg.DEFAULT_BASE64_LOADING_GIF, time_between_frames=100)
else:
psg.popup_animated(None)
if event == 'Download Files':
loading = True
download_thread() # pretend this is threaded
if event == 'Cancel':
loading = False

