Re: Interference tkinter and plot from matplotlib

2020-10-01 Thread Pierre Bonville
Thank you, Mr. Gollwitzer. I understand the problem. I'll see what I can do.
Regards,
P.Bonville


Le mer. 30 sept. 2020 à 17:02, Christian Gollwitzer  a
écrit :

> 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
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Interference tkinter and plot from matplotlib

2020-09-30 Thread Christian Gollwitzer

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
--
https://mail.python.org/mailman/listinfo/python-list


Interference tkinter and plot from matplotlib

2020-09-30 Thread Pierre Bonville
 Hi everybody,
I am running this little program below on Win 10 with Python 3.8 (just
typing prog.py after the prompt c:\Users ...>), and while it correctly
displays the window and does the first plt.plot(), it does not reach the
input command and remains waiting after I shut the plot. If I replace
'quit' by 'destroy' in the button command, it works correctly. I looked on
various Python forums on the Net, but didn't find an answer.
Regards,
P.Bonville

import tkinter as tk
import matplotlib.pyplot as plt
r = tk.Tk()
b = tk.Button(r, text= r.quit)
b = tk.Button(r, text='quit', command=r.quit)
b.pack()
r.mainloop()  # This blocks until press button.
# Root window with button is still displayed.
plt.plot()
plt.show()
rep = input("Return")
plt.plot()
plt.show()
-- 
https://mail.python.org/mailman/listinfo/python-list