Interference tkinter and plot from matplotlib

Christian Gollwitzer auriocus at gmx.de
Wed Sep 30 10:56:26 EDT 2020


Am 30.09.20 um 15:46 schrieb Pierre Bonville:
>   Hi everybody,

> Interference tkinter and plot from matplotlib


You are mixing different ways of control flow. In a GUI program, don't 
call input(). Use the mainloop() as the very last of your calls, and 
only work in the callbacks. That means you would integrate a "Next" 
button in your GUI which switches the plots - or even show them side by 
side.

Concerning matplotlib, you'll need to tell it to integrate with Tk 
properly.
https://matplotlib.org/3.3.1/gallery/user_interfaces/embedding_in_tk_sgskip.html


If you want a simple solution instead of full-blown GUI programming, use 
IPython https://ipython.readthedocs.io/en/stable/config/eventloops.html
or jupyter notebooks.


	Christian


More information about the Python-list mailing list