Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plots are requiring a Ctrl+C in the Python console when using the Qt4 backend on Windows #2788

Closed
stonebig opened this issue Oct 30, 2015 · 9 comments

Comments

@stonebig
Copy link
Contributor

on recent winpython with ipython4, spyder 2.3.6 , 2.3.7, 3.0dev (matplotlib 1.4.3 or 1.5rc3) , qtconsole 4.1, it seems an old issue is coming back.

test:

  • launch spyder
  • type this script and launch it in current Python (not Ipython) console:
import matplotlib.pyplot as plt
plt.scatter([0], [0])
plt.show()
plt.pause(5)
# plt.close  # will close the 'pending' tcl/tk window if you relaunch the script on same console !

effect:

  • the tcl/tk windows open, show the graphic, thanks to the pause
  • then enters in 'unresponsive` mode
  • apparently, spyder seems to have taken back it's event loop, so is not directly affected.

I don't know if it's truly a spyder issue.

winpython/winpython#191

@stonebig
Copy link
Contributor Author

known workaround is to launch on an external terminal, or in the qtconsole

@ccordoba12 ccordoba12 added this to the v2.3.8 milestone Nov 16, 2015
@ccordoba12 ccordoba12 changed the title tck/tk issue (again) Plots freeze in the Python console when using the Tk backend Nov 16, 2015
@ccordoba12
Copy link
Member

I'll try to fix this for Spyder 2.3.8

@ccordoba12 ccordoba12 modified the milestones: v3.0, v2.3.8 Nov 21, 2015
@ccordoba12
Copy link
Member

My findings (using Anaconda):

  1. Plots with Tk block our Python consoles on Windows, i.e. they show up and you can interact with them as expected, but after that you can't evaluate further commands.
  2. I also tried to create plots on a terminal, and the console blocks after running plt.show(). That means that the Tk event loop (which comes with Python itself) is not working on Windows.
  3. We rely on the Tk event loop to be working because we don't have one. So if it fails, there's nothing we can do about it. This is (most probably) the problem you're seeing in WinPython too.

Given this situation, I decided to remove support for Tk on Windows for Python 3. Besides:

  1. Things are working pretty well on the IPython console, so if people want to use Tk, they should use it instead.
  2. The Qt4Agg backend works also very well on our Python consoles, so if people wants plots on those consoles, they are going to get them (at least in Spyder 2.3. There seems to be a bug in master :-)

@ccordoba12 ccordoba12 changed the title Plots freeze in the Python console when using the Tk backend Plots freeze in the Python console when using the Tk backend on Windows Nov 25, 2015
@ccordoba12
Copy link
Member

Sorry, support is not only removed for Python 3, but also for Python 2. And this is now part of Spyder 3.0.

@ccordoba12
Copy link
Member

I just fixed the problem in master the problem with plots using the Automatic (i.e. PyQt4 or 5) backend, so everything is back to normal for our Python consoles.

@stonebig
Copy link
Contributor Author

ok. will you do a new 3.0 beta soon ?

@ccordoba12
Copy link
Member

Yes, working ot it :-) I hope to have it for this weekend.

El 25/11/15 a las 12:50, stonebig escribió:

ok. will you do a new beta soon ?


Reply to this email directly or view it on GitHub
#2788 (comment).

@stonebig
Copy link
Contributor Author

super

@stonebig
Copy link
Contributor Author

the complainer's remark is that there is no "Tk" in the given test he does. This was an error of interpretation from me.

On today master, the issue described here is still there, even if I specify 'Qt4':

import matplotlib as mpl
mpl.use('Qt4Agg')

import matplotlib.pyplot as plt
plt.scatter([0], [0])

@stonebig stonebig changed the title Plots freeze in the Python console when using the Tk backend on Windows Plots are requiring a Ctrl+C in the Python console when using the Qt4 backend on Windows Nov 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants