I dynamically create ogl.Shapes,
and some of these objects needs a regular refresh.
So with the help of "Nitro", I realized it for 1 object,
like this:
class T6963_device (ogl.BitmapShape):
def __init__(self, Container):
ogl.BitmapShape.__init__ (self)
# Create a timer, and fetch the event of the container
self.t1 = wx.Timer (Container)
Container.Bind(wx.EVT_TIMER, self.OnTimer)
self.t1.Start ( 100 )
This works great for the first object created,
but if I create another ogl.shape object,
that also needs a timer for some regular refresh,
the event binding goes to the second object,
ans the actions of my first object will nor be performed anymore.
So how do I join multiple actions from different objects in the same container ?
I dynamically create ogl.Shapes,
and some of these objects needs a regular refresh.
So with the help of "Nitro", I realized it for 1 object,
like this:
class T6963_device (ogl.BitmapShape):
def __init__(self, Container):
ogl.BitmapShape.__init__ (self)
# Create a timer, and fetch the event of the container
self.t1 = wx.Timer (Container)
Container.Bind(wx.EVT_TIMER, self.OnTimer)
self.t1.Start ( 100 )
I dynamically create ogl.Shapes,
and some of these objects needs a regular refresh.
So with the help of "Nitro", I realized it for 1 object,
like this:
class T6963_device (ogl.BitmapShape):
def __init__(self, Container):
ogl.BitmapShape.__init__ (self)
# Create a timer, and fetch the event of the container
self.t1 = wx.Timer (Container)
Container.Bind(wx.EVT_TIMER, self.OnTimer)
self.t1.Start ( 100 )
btw, what a strange name "Skip",
what is there to be skipped ?
In Delphi this is called "inherited", which I can understand better.
cheers,
Stef Mientki
···
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I dynamically create ogl.Shapes,
and some of these objects needs a regular refresh.
So with the help of "Nitro", I realized it for 1 object,
like this:
class T6963_device (ogl.BitmapShape):
def __init__(self, Container):
ogl.BitmapShape.__init__ (self)
# Create a timer, and fetch the event of the container
self.t1 = wx.Timer (Container)
Container.Bind(wx.EVT_TIMER, self.OnTimer)
self.t1.Start ( 100 )
btw, what a strange name "Skip",
what is there to be skipped ?
In Delphi this is called "inherited", which I can understand better.
Skip means that the event should not end its journey at this particular event
handler but rather skip it so that other event handlers will be able to receive
it, too. I don't find the name that bad.
btw, what a strange name "Skip",
what is there to be skipped ?
In Delphi this is called "inherited", which I can understand better.
Skip means that the event should not end its journey at this particular event
handler but rather skip it so that other event handlers will be able to receive
it, too. I don't find the name that bad.
ok, what's in a name.
But a few more essential questions:
- does it matter where the "Skip()" is placed (at the beginning or the end) of my own event handling ?
- is it allowed to place a "Skip()" in all the event handlers that should "chain" actions ?
- I should have started with this question any good link to "Skip()" function ?
btw, what a strange name "Skip",
what is there to be skipped ?
In Delphi this is called "inherited", which I can understand better.
Skip means that the event should not end its journey at this
particular event
handler but rather skip it so that other event handlers will be able
to receive
it, too. I don't find the name that bad.
ok, what's in a name.
But a few more essential questions:
- does it matter where the "Skip()" is placed (at the beginning or the
end) of my own event handling ?
anywhere is fine. The next handler will not be called before your app is back in
the main loop anyway.
- is it allowed to place a "Skip()" in all the event handlers that
should "chain" actions ?
I think so, yes.
Btw. some events can be vetoed calling event.Veto() in the event handler thus
preventing them from happening.
btw, what a strange name "Skip",
what is there to be skipped ?
In Delphi this is called "inherited", which I can understand better.
Skip means that the event should not end its journey at this
particular event
handler but rather skip it so that other event handlers will be able
to receive
it, too. I don't find the name that bad.
ok, what's in a name.
But a few more essential questions:
- does it matter where the "Skip()" is placed (at the beginning or the
end) of my own event handling ?
anywhere is fine. The next handler will not be called before your app is back in
the main loop anyway.
- is it allowed to place a "Skip()" in all the event handlers that
should "chain" actions ?
I think so, yes.
Btw. some events can be vetoed calling event.Veto() in the event handler thus
preventing them from happening.
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I dynamically create ogl.Shapes,
and some of these objects needs a regular refresh.
So with the help of "Nitro", I realized it for 1 object,
like this:
class T6963_device (ogl.BitmapShape):
def __init__(self, Container):
ogl.BitmapShape.__init__ (self)
# Create a timer, and fetch the event of the container
self.t1 = wx.Timer (Container)
Container.Bind(wx.EVT_TIMER, self.OnTimer)
self.t1.Start ( 100 )
This works great for the first object created,
but if I create another ogl.shape object,
that also needs a timer for some regular refresh,
the event binding goes to the second object,
ans the actions of my first object will nor be performed anymore.
So how do I join multiple actions from different objects in the same container ?
You've already gotten some answers relating to using Skip to allow a single even to propagate to multiple handlers, but it sounds to me like you are actually wanting something else. You want to be able to have multiple timers and each one will call a different handler when it expires, right? To do that you just need to use the timer object as the source parameter to the Bind method, like this:
> Stef Mientki wrote:
> >
> > - is it allowed to place a "Skip()" in all the event handlers that
> > should "chain" actions ?
>
> I think so, yes.
>
> Btw. some events can be vetoed calling event.Veto() in the event handler thus
> preventing them from happening.
>
In general, you should always call Skip() unless you know exactly what
behavior you're preventing by not calling it.
This is somewhat contradicting what I found when I wrote GUI2Exe: Mac
users reported that calling Skip on menu events (whatever a Skip
instruction may do on menu handlers...) was not a Good Thing.
Actually, calling Skip on menu events caused the same menu handler to
be called forever and ever, in an evil "circulus vitiosus" without
end. From one side, I was warned that calling Skip was not a good
idea, while my usual programming practice was (and still is) to call
Skip on all events unless I know what I am blocking.
In general, you should always call Skip() unless you know exactly what
behavior you're preventing by not calling it.
This is somewhat contradicting what I found when I wrote GUI2Exe: Mac
users reported that calling Skip on menu events (whatever a Skip
instruction may do on menu handlers...) was not a Good Thing.
my usual programming practice was (and still is) to call
Skip on all events unless I know what I am blocking.
As it happens, I don't think I've EVER called Skip(), certainly rarely.
I guess it depends on what you're doing.
-CHB
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
So how do I join multiple actions from different objects in the same container ?
You've already gotten some answers relating to using Skip to allow a single even to propagate to multiple handlers, but it sounds to me like you are actually wanting something else. You want to be able to have multiple timers and each one will call a different handler when it expires, right?
Robin, You hit the nail right on its head !
To do that you just need to use the timer object as the source parameter to the Bind method, like this: