@@ -120,19 +120,15 @@ class TimerWx(TimerBase):
120
120
121
121
'''
122
122
123
- def __init__ (self , parent , * args , ** kwargs ):
123
+ def __init__ (self , * args , ** kwargs ):
124
+ if isinstance (args [0 ], wx .EvtHandler ):
125
+ cbook .warn_deprecated (
126
+ "3.0" , "Passing a wx.EvtHandler as first argument to the "
127
+ "TimerWx constructor is deprecated since %(version)s." )
128
+ args = args [1 :]
124
129
TimerBase .__init__ (self , * args , ** kwargs )
125
-
126
- # Create a new timer and connect the timer event to our handler.
127
- # For WX, the events have to use a widget for binding.
128
- self .parent = parent
129
- self ._timer = wx .Timer (self .parent , wx .NewId ())
130
- self .parent .Bind (wx .EVT_TIMER , self ._on_timer , self ._timer )
131
-
132
- # Unbinding causes Wx to stop for some reason. Disabling for now.
133
- # def __del__(self):
134
- # TimerBase.__del__(self)
135
- # self.parent.Bind(wx.EVT_TIMER, None, self._timer)
130
+ self ._timer = wx .Timer ()
131
+ self ._timer .Notify = self ._on_timer
136
132
137
133
def _timer_start (self ):
138
134
self ._timer .Start (self ._interval , self ._single )
@@ -146,9 +142,6 @@ def _timer_set_interval(self):
146
142
def _timer_set_single_shot (self ):
147
143
self ._timer .Start ()
148
144
149
- def _on_timer (self , * args ):
150
- TimerBase ._on_timer (self )
151
-
152
145
153
146
class RendererWx (RendererBase ):
154
147
"""
@@ -706,7 +699,7 @@ def new_timer(self, *args, **kwargs):
706
699
will be executed by the timer every *interval*.
707
700
708
701
"""
709
- return TimerWx (self , * args , ** kwargs )
702
+ return TimerWx (* args , ** kwargs )
710
703
711
704
def flush_events (self ):
712
705
wx .Yield ()
0 commit comments