takluyver / pynsist

Build Windows installers for Python applications
https://pynsist.readthedocs.io/
Other
882 stars 119 forks source link

tkinter and windows manager #152

Closed sandba66er closed 6 years ago

sandba66er commented 6 years ago

I've been having trouble with several tkinter items related to the windows manager. Things like:

grab_set() focus_set() # this sorta works in some cases

Also the filedialogs such as:

filedialog.asksaveasfilename filedialog.askopenfile

Whenever I prompt a user to 'load' a file or 'save as...', the main window is not disabled as it should be. This allows them to bring up repeated dialogs. I need modal windows in other instances as well. All of these things work as expected before packaging with pynsist.

.wm_attributes("-disabled", True) works and is a decent workaround for now. That or disabling all my widgets and then enabling again after. I still have some scenarios where these workarounds are not enough.

takluyver commented 6 years ago

Some things may behave differently when running with pythonw, the 'GUI' Python that doesn't need a console window. I don't know much about tkinter, though.

sandba66er commented 6 years ago

I’m closing this issue since learning this is not an issue with pynsist. I have tracked it down to an issue specific to matplotlib and the TkAgg backend.

Apparently the figure needs to be added to the canvas before creating a plot when embedding matplotlib in tkinter with a TkAgg backend… Who knew? They even make this mistake in their examples! Not doing things in this order will cause all kinds of havoc in tkinter. Beyond what was described, Variable classes such as BooleanVar and Intvar variables won’t change. Apparently sliders and other types of widgets will also be unresponsive.

I wasn’t specifying which backend to use because my anaconda version was defaulting to the Qt5Agg backend which worked fine. The pynsist build, however, was bundling with the TkAgg backend. Apologies for any time you may have wasted looking in to this.