Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d4cc11

Browse files
committed
Don't associate Wx timers with the parent frame.
This is consistent with the behavior on Qt and GTK, and avoids asegfault due to lack of disconnection of the timer after the parentwidget is destroyed (otherwise, we'd need to keep track of timersassociated with each widget and tear them down when the widget isdestroyed).
1 parent5211ed8 commit9d4cc11

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

‎doc/api/next_api_changes/2018-02-15-AL-deprecations.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ The following rcParams are deprecated:
4848
The following keyword arguments are deprecated:
4949
- passing ``verts`` to ``Axes.scatter`` (use ``marker`` instead),
5050
- passing ``obj_type`` to ``cbook.deprecated``,
51+
52+
The following call signatures are deprecated:
53+
- passing a ``wx.EvtHandler`` as first argument to ``backend_wx.TimerWx``,

‎lib/matplotlib/backends/backend_wx.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,15 @@ class TimerWx(TimerBase):
118118
119119
'''
120120

121-
def__init__(self,parent,*args,**kwargs):
121+
def__init__(self,*args,**kwargs):
122+
ifisinstance(args[0],wx.EvtHandler):
123+
cbook.warn_deprecated(
124+
"3.0","Passing a wx.EvtHandler as first argument to the "
125+
"TimerWx constructor is deprecated since %(version)s.")
126+
args=args[1:]
122127
TimerBase.__init__(self,*args,**kwargs)
123-
124-
# Create a new timer and connect the timer event to our handler.
125-
# For WX, the events have to use a widget for binding.
126-
self.parent=parent
127-
self._timer=wx.Timer(self.parent,wx.NewId())
128-
self.parent.Bind(wx.EVT_TIMER,self._on_timer,self._timer)
129-
130-
# Unbinding causes Wx to stop for some reason. Disabling for now.
131-
# def __del__(self):
132-
# TimerBase.__del__(self)
133-
# self.parent.Bind(wx.EVT_TIMER, None, self._timer)
128+
self._timer=wx.Timer()
129+
self._timer.Notify=self._on_timer
134130

135131
def_timer_start(self):
136132
self._timer.Start(self._interval,self._single)
@@ -144,9 +140,6 @@ def _timer_set_interval(self):
144140
def_timer_set_single_shot(self):
145141
self._timer.Start()
146142

147-
def_on_timer(self,*args):
148-
TimerBase._on_timer(self)
149-
150143

151144
classRendererWx(RendererBase):
152145
"""
@@ -704,7 +697,7 @@ def new_timer(self, *args, **kwargs):
704697
will be executed by the timer every *interval*.
705698
706699
"""
707-
returnTimerWx(self,*args,**kwargs)
700+
returnTimerWx(*args,**kwargs)
708701

709702
defflush_events(self):
710703
wx.Yield()

‎lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ def _get_testable_interactive_backends():
2929
reason="No $DISPLAY"
3030
elifany(importlib.util.find_spec(dep)isNonefordepindeps):
3131
reason="Missing dependency"
32-
elif"wx"indepsandsys.platform=="darwin":
33-
reason="wx backends known not to work on OSX"
3432
backends.append(pytest.mark.skip(reason=reason)(backend)ifreason
3533
elsebackend)
3634
returnbackends

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp