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

Using a single-shot timer with the Wx backend raises an AttributeError #2550

Merged
merged 1 commit into from Oct 30, 2013

Conversation

joferkington
Copy link
Contributor

With the WxAgg backend, the following results in an error (it works properly on any other backend):

import matplotlib
matplotlib.use('WxAgg')
import matplotlib.pyplot as plt

def ping():
    print 'ping'

fig, ax = plt.subplots()

timer = fig.canvas.new_timer(interval=1, callbacks=[(ping, [], {})])
timer.single_shot = True
timer.start()

plt.show()

This yields:

Traceback (most recent call last):
  File "wx_timer_issue.py", line 10, in <module>
    tim.single_shot = True
  File "/usr/local/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 1164, in _set_single_shot
    self._timer_set_single_shot()
  File "/usr/local/lib64/python2.7/site-packages/matplotlib/backends/backend_wx.py", line 206, in _timer_set_single_shot
    self._timer.start()
AttributeError: 'Timer' object has no attribute 'start'

This appears to be the result of a simple typo in wx_backend.py.

@tacaswell
Copy link
Member

👍

This should probably be against v1.3.x

@mdboom
Copy link
Member

mdboom commented Oct 30, 2013

@WeatherGod: Start comes from wx, not us, so there's not much we can do to change it.

mdboom added a commit that referenced this pull request Oct 30, 2013
Using a single-shot timer with the Wx backend raises an AttributeError
@mdboom mdboom merged commit e7d6cc8 into matplotlib:master Oct 30, 2013
mdboom added a commit that referenced this pull request Oct 30, 2013
Using a single-shot timer with the Wx backend raises an AttributeError
@mdboom
Copy link
Member

mdboom commented Oct 30, 2013

Cherry-picked to 1.3.x as 3ccb41c

@joferkington joferkington deleted the fix-wx-singleshot-timer branch November 1, 2013 14:31
joferkington added a commit to joferkington/mpldatacursor that referenced this pull request Nov 2, 2013
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.

None yet

5 participants