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

Matplotlib RadioButton Clicks Lost only when Executing in IPython Console #2843

Closed
slehar opened this issue Dec 2, 2015 · 2 comments
Closed

Comments

@slehar
Copy link

slehar commented Dec 2, 2015

Description

A very simple Matplotlib program using widgets.RadioButton loses mouse clicks - or stores them till the next click - but only when Python > Preferences > Run is set to

(0) Execute in current Python or IPython console

the problem disappears if you select either

(0) Execute in a new dedicated Python console
...or...
(0) Execute in an external System terminal

When the problem occurs, the original terminal where I typed "spyder&" to launch spyder reports...

QTextCursor::setPosition: Position '9913' out of range
QTextCursor::setPosition: Position '9938' out of range
QTextCursor::setPosition: Position '9608' out of range
QTextCursor::setPosition: Position '9645' out of range
QTextCursor::setPosition: Position '9670' out of range
...

for each postponed mouse click.

What steps will reproduce the problem?

Run this simple RadioButton script that selects Sex M or F.


import matplotlib.pyplot as plt
from matplotlib.widgets import RadioButtons

fig = plt.figure()
ax = plt.axes([.4, .4, .2, .3])
plt.title('Sex')
    
# Radio buttons in ax
radioSex    = RadioButtons(ax, ['Male', 'Female'])

def sexfunc(label):
     print 'In sexfunc()'
    sexdict = {'Male':'M', 'Female':'F'}
    sex = sexdict[label]
    print '  sex = %r'%sex
radioSex.on_clicked(sexfunc)

plt.show()

What is the expected output? What do you see instead?

With the proper Run selection every time you click "Male" or "Female" the console shows your selection immediately.

In sexfunc()
  sex = 'M'
In sexfunc()
  sex = 'F'

With the wrong Run selection the first click is ignored (nothing is printed), then the second click shows the result of the first click, and from there it is always one click behind.

For example the initial default selection is Male. I click Female and nothing happens. Then I click Male and it reports "sex = 'F'". I click back to Female and it reports "sex = 'M'", and so forth.

It is like it buffers the click and releases it only on the next click, always one step behind.

Please provide any additional information below

Version and main components

  • Spyder Version: 2.3.7
  • Python Version: 2.7.10
  • Qt Versions: 4.8.7, PyQt4 (API v2) 4.11.4 on Darwin

Optional dependencies

pyflakes >=0.5.0   :  1.0.0 (OK)
pep8 >=0.6         :  1.6.2 (OK)
pygments >=1.6     :  2.0.2 (OK)
IPython >=1.0      :  4.0.0 (OK)
zmq >=2.1.11       :  14.7.0 (OK)
qtconsole >=4.0    :  4.1.0 (OK)
pandas >=0.13.1    :  0.17.0 (OK)
sphinx >=0.6.6     :  1.3.1 (OK)
psutil >=0.3       :  3.2.2 (OK)
rope >=0.9.2       :  0.9.4 (OK)
jedi >=0.8.1;<0.9.0:  0.9.0 (NOK)
matplotlib >=1.0   :  1.4.3 (OK)
sympy >=0.7.3      :  0.7.6.1 (OK)
pylint >=0.25      :  None (NOK)

@ccordoba12
Copy link
Member

Thanks for reporting. We'll see what we can do about it for Spyder 3.0.

@ccordoba12 ccordoba12 modified the milestones: v3.1, v3.0 Dec 16, 2015
@ccordoba12 ccordoba12 removed this from the todo milestone Jun 25, 2017
@ccordoba12
Copy link
Member

Closing because the Python console is going to be removed in Spyder 3.2.

Please see issue #4524 for our reasons to do this.

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