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

Fix185 (take two) #237

Merged
1 commit merged into from
Feb 23, 2011
Merged

Fix185 (take two) #237

1 commit merged into from
Feb 23, 2011

Conversation

ivanov
Copy link
Member

@ivanov ivanov commented Dec 29, 2010

The original issue was created by a portion of commit 3e84e9f which I'll refer to as "problematic commit".

My fix185 branch originally undid a portion of the problematic commit, and the outstanding issue relates to other portions of that same commit.

What isn't clear to me is the purpose of the function check_gtk inside Shell.py, which was added in the problematic commit. For some reason, it unconditionally returns mode 'tkthread' if gtk was safely imported and hasattr 'set_interactive', regardless of what mode was passed to it. This "functionality" is not used with the -pylab flag, which is why original one line change did not fix the issue for "ipython -gthread"

I added another commit to the fix185 branch which removes check_gtk() altogether, and see no issues using ipython -gthread, ipython -gthread -pylab, or ipython -pylab. Additionally, the check_gtk() imported gtk regardless of what mode the user selected, and might also be what's been causing the "Why is IPython using X11" threads on the mailing list.

also, I just want to note here that users will see this issue if they use e.g "ipython -gthread" but their matplotlib is set to some other backend by default (say "WX").

It was unclear why the function check_gtk() was added in the first
place, but plt.show() blocked when using "ipython -gthread" without
the "-pylab"

also, I just want to note here that users will still experience blocking
behaviour if they use e.g "ipython -gthread" but their matplotlib is set
to some other backend by default (say "WX").
@markvoorhies
Copy link
Contributor

Works for me with the GTK backend. For what it's worth, here are my tests pre (972dc9) and post (7fb20b)
Paul's fix, with the GTK and TkAgg backends:

commit: 972dc9
backend: GTK
invocation: ipython --pylab
test: plot(rand(100)) ; show()
result: blocks (even after closing figure window)

commit: 972dc9
backend: GTK
invocation: ipython --pylab --gthread
test: plot(rand(100))
result: works without blocking

commit: 972dc9
backend: GTK
invocation: ipython --gthread
test: import matplotlib.pyplot as plt ; plt.plot([1,2]) ; plt.show()
result: blocks until figure window is closed

commit: 972dc9
backend: TkAgg
invocation: ipython --pylab
test: plot(rand(100)) ; show()
result: works without blocking

commit: 972dc9
backend: TkAgg
invocation: ipython --pylab --gthread
test: plot(rand(100))
result: works without blocking

commit: 972dc9
backend: TkAgg
invocation: ipython --gthread
test: import matplotlib.pyplot as plt ; plt.plot([1,2]) ; plt.show()
result: blocks until figure window is closed

commit: 7fb20b
backend: GTK
invocation: ipython --pylab
test: plot(rand(100)) ; show()
result: works without blocking

commit: 7fb20b
backend: GTK
invocation: ipython --pylab --gthread
test: plot(rand(100))
result: works without blocking

commit: 7fb20b
backend: GTK
invocation: ipython --gthread
test: import matplotlib.pyplot as plt ; plt.plot([1,2]) ; plt.show()
result: works without blocking

commit: 7fb20b
backend: TkAgg
invocation: ipython --pylab
test: plot(rand(100)) ; show()
result: works without blocking

commit: 7fb20b
backend: TkAgg
invocation: ipython --pylab --gthread
test: plot(rand(100))
result: works without blocking

commit: 7fb20b
backend: TkAgg
invocation: ipython --gthread
test: import matplotlib.pyplot as plt ; plt.plot([1,2]) ; plt.show()
result: blocks until figure window is closed

@minrk
Copy link
Member

minrk commented Feb 14, 2011

This looks promising (Thanks for the tests!) The comments around that code suggest that it had something to do with older versions of pygtk. Can anyone shed light on that?

@fperez
Copy link
Member

fperez commented Feb 23, 2011

Thanks, Paul and Mark! Sorry for the long delay in merging...

@minrk minrk added this to the old milestone Apr 10, 2014
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants