[wxPython] Deletion of wxTimer objects

RE: [wxPython] Deletion of wxTimer objects

As soon as I change the id to something non-default

I don’t get the callback invoked anymore.

By the way, I am doing the creation of the timer in

a global function, but passing in the main frame as the

event source, and using a global function as the event

handler. Is this ok?

···

-----Original Message-----

From: Robin Dunn [mailto:robin@alldunn.com]

Sent: Friday, March 22, 2002 10:16 AM

To: wxpython-users@lists.wxwindows.org

Subject: Re: [wxPython] Deletion of wxTimer objects

I’ve tried that approach, but unfortunately I need two

timers running and haven’t figured out how to make both

run at the same time (but with different intervals). I

can only actually get the event handler called if both

timers have an id of -1, and I think when they have the

same id they interfere with each other.

Use different, non-default, IDs.

timer1 = wxTimer(self, ID1)

timer2 = wxTimer(self, ID2)

EVT_TIMER(self, ID1, self.OnTimer1)

EVT_TIMER(self, ID2, self.OnTimer2)

Robin Dunn

Software Craftsman

robin@AllDunn.com Java give you jitters?

http://wxPython.org Relax with wxPython!


wxpython-users mailing list

wxpython-users@lists.wxwindows.org

http://lists.wxwindows.org/mailman/listinfo/wxpython-users

As soon as I change the id to something non-default
I don't get the callback invoked anymore.

Drop the attached in your demo directory and give it a try. It works for
me.

By the way, I am doing the creation of the timer in
a global function, but passing in the main frame as the
event source, and using a global function as the event
handler. Is this ok?

It should be. Do you save a reference to your timers?

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

begin 666 wxTimer.py
M#0IF<F]M('=X4'ET:&]N+G=X(&EM<&]R=" J#0H-"FEM<&]R="!T:6UE#0H-
M"B,M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2T-"@T*(R,@8VQA<W,@
M5&5S=%1I;65R*'=X5&EM97(I.@T*(R,@(" @(&1E9B!?7VEN:71?7RAS96QF
M+"!L;V<@/2!.;VYE*3H-"B,C(" @(" @(" @=WA4:6UE<BY?7VEN:71?7RAS
M96QF*0T*(R,@(" @(" @("!S96QF+FQO9R ](&QO9PT*(R,@(" @(&1E9B!.
M;W1I9GDH<V5L9BDZ#0HC(R @(" @(" @('=X0F5L;"@I#0HC(R @(" @(" @
M(&EF('-E;&8N;&]G.@T*(R,@(" @(" @(" @(" @<V5L9BYL;V<N5W)I=&54
M97AT*"=B965P(5QN)RD-"@T*(RTM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+0T*#0I)1%]3=&%R=" @/2!W>$YE=TED*"D-"DE$7U-T;W @(" ]('=X
M3F5W260H*0T*241?5&EM97(@(#T@=WA.97=)9"@I#0I)1%]4:6UE<C(@/2!W

$YE=TED*"D-"@T*8VQA<W,@5&5S=%1I;65R5VEN*'=X4&%N96PI.@T*(" @

M(&1E9B!?7VEN:71?7RAS96QF+"!P87)E;G0L(&QO9RDZ#0H@(" @(" @('=X
M4&%N96PN7U]I;FET7U\H<V5L9BP@<&%R96YT+" M,2D-"B @(" @(" @<V5L
M9BYL;V<@/2!L;V<-"@T*(" @(" @("!W>%-T871I8U1E>'0H<V5L9BP@+3$L
M(")4:&ES(&ES(&$@=&EM97(@97AA;7!L92(L#0H@(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @=WA0;VEN="@Q-2P@,S I*0T*#0H@(" @(" @('=X
M0G5T=&]N*'-E;&8L($E$7U-T87)T+" G(%-T87)T("<L('=X4&]I;G0H,34L
M(#<U*2P@=WA$969A=6QT4VEZ92D-"B @(" @(" @=WA"=71T;VXH<V5L9BP@
M241?4W1O<"P@)R!3=&]P("<L('=X4&]I;G0H,3$U+" W-2DL('=X1&5F875L
M=%-I>F4I#0H-"B @(" @(" @<V5L9BYT:6UE<B ]('=X5&EM97(H<V5L9BP@
M(" @(" C(&]B:F5C="!T;R!S96YD('1H92!E=F5N="!T;PT*(" @(" @(" @
M(" @(" @(" @(" @(" @(" @("!)1%]4:6UE<BD@(",@979E;G0@:60@=&\@
M=7-E#0H-"B @(" @(" @<V5L9BYT:6UE<C(@/2!W>%1I;65R*'-E;&8L(" @
M(" @(R!O8FIE8W0@=&\@<V5N9"!T:&4@979E;G0@=&\-"B @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @241?5&EM97(R*2 @(R!E=F5N="!I9"!T;R!U
M<V4-"@T*(" @(" @("!%5E1?0E545$].*'-E;&8L($E$7U-T87)T+"!S96QF
M+D]N4W1A<G0I#0H@(" @(" @($565%]"55143TXH<V5L9BP@241?4W1O<"P@
M('-E;&8N3VY3=&]P*0T*(" @(" @("!%5E1?5$E-15(H<V5L9BP@($E$7U1I
M;65R+"!S96QF+D]N5&EM97(I#0H@(" @(" @($565%]424U%4BAS96QF+" @
M241?5&EM97(R+"!S96QF+D]N5&EM97(R*0T*#0H@(" @9&5F($]N4W1A<G0H
M<V5L9BP@979E;G0I.@T*(" @(" @("!S96QF+G1I;65R+E-T87)T*#$P,# I
M#0H@(" @(" @('-E;&8N=&EM97(R+E-T87)T*#$U,# I#0H-"B @("!D968@
M3VY3=&]P*'-E;&8L(&5V96YT*3H-"B @(" @(" @<V5L9BYT:6UE<BY3=&]P
M*"D-"B @(" @(" @<V5L9BYT:6UE<C(N4W1O<"@I#0H-"B @("!D968@3VY4
M:6UE<BAS96QF+"!E=F5N="DZ#0H@(" @(" @('=X0F5L;"@I#0H@(" @(" @
M(&EF('-E;&8N;&]G.@T*(" @(" @(" @(" @<V5L9BYL;V<N5W)I=&5497AT
M*"=B965P(5QN)RD-"@T*(" @(&1E9B!/;E1I;65R,BAS96QF+"!E=F5N="DZ
M#0H@(" @(" @('=X0F5L;"@I#0H@(" @(" @(&EF('-E;&8N;&]G.@T*(" @
M(" @(" @(" @<V5L9BYL;V<N5W)I=&5497AT*"=B965P(#(A7&XG*0T*#0HC
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M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