Hi, so basically I have an application with a square in the middle that blinks at a certain frequency. The frequency is determined by pyglet.clock.schedule_interval(Blinker, Rate). It basically calls the function Blinker at the time interval of Rate. Now, I have @window.event section, where I have defined on_draw(). Everything works fine, except that on_draw() is triggered on every window event, including hovering the mouse over the window. How do I disable all window events, except the function call? Thanks.
On Fri, Oct 19, 2012 at 2:29 PM, hotelCA <it.is.t...@gmail.com> wrote:
> Hi, so basically I have an application with a square in the middle that
> blinks at a certain frequency. The frequency is determined by
> pyglet.clock.schedule_interval(Blinker, Rate). It basically calls the
> function Blinker at the time interval of Rate. Now, I have @window.event
> section, where I have defined on_draw(). Everything works fine, except that
> on_draw() is triggered on every window event, including hovering the mouse
> over the window. How do I disable all window events, except the function
> call? Thanks.
You could just not implement the on_draw() event. Just rename your
on_draw() to some other name, and don't decorate it as the on_draw() event,
and then just call it when you want to.
> On Fri, Oct 19, 2012 at 2:29 PM, hotelCA <it.is.t...@gmail.com> wrote:
>> Hi, so basically I have an application with a square in the middle that
>> blinks at a certain frequency. The frequency is determined by
>> pyglet.clock.schedule_interval(Blinker, Rate). It basically calls the
>> function Blinker at the time interval of Rate. Now, I have @window.event
>> section, where I have defined on_draw(). Everything works fine, except that
>> on_draw() is triggered on every window event, including hovering the mouse
>> over the window. How do I disable all window events, except the function
>> call? Thanks.
> You could just not implement the on_draw() event. Just rename your
> on_draw() to some other name, and don't decorate it as the on_draw() event,
> and then just call it when you want to.
> ~ Nathan
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To post to this group, send email to pyglet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> pyglet-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyglet-users?hl=en.
I have attached a modified code, using your advice. It now flickers totally randomly. I don't know what's wrong. Could you take a look at the code and point out what I have done wrong?
On Monday, October 22, 2012 11:00:18 AM UTC-5, Nathan wrote:
> On Fri, Oct 19, 2012 at 2:29 PM, hotelCA <it.is...@gmail.com <javascript:> > > wrote:
>> Hi, so basically I have an application with a square in the middle that >> blinks at a certain frequency. The frequency is determined by >> pyglet.clock.schedule_interval(Blinker, Rate). It basically calls the >> function Blinker at the time interval of Rate. Now, I have @window.event >> section, where I have defined on_draw(). Everything works fine, except that >> on_draw() is triggered on every window event, including hovering the mouse >> over the window. How do I disable all window events, except the function >> call? Thanks.
> You could just not implement the on_draw() event. Just rename your > on_draw() to some other name, and don't decorate it as the on_draw() event, > and then just call it when you want to.
Hi Quoc,
I see no strange flickering except with higher blinking rates. This is
normal because a normal computer monitor will only refresh 60 times
per second, so it can't blink at the perfect rate and will instead
cause irregular blinking.
So this is a hardware limitation, nothing to do with pyglet (if I
understand correctly).
On 25 October 2012 00:14, hotelCA <it.is.t...@gmail.com> wrote:
> I have attached a modified code, using your advice. It now flickers totally
> randomly. I don't know what's wrong. Could you take a look at the code and
> point out what I have done wrong?
> Thanks,
> Quoc
> On Monday, October 22, 2012 11:00:18 AM UTC-5, Nathan wrote:
>> On Fri, Oct 19, 2012 at 2:29 PM, hotelCA <it.is...@gmail.com> wrote:
>>> Hi, so basically I have an application with a square in the middle that
>>> blinks at a certain frequency. The frequency is determined by
>>> pyglet.clock.schedule_interval(Blinker, Rate). It basically calls the
>>> function Blinker at the time interval of Rate. Now, I have @window.event
>>> section, where I have defined on_draw(). Everything works fine, except that
>>> on_draw() is triggered on every window event, including hovering the mouse
>>> over the window. How do I disable all window events, except the function
>>> call? Thanks.
>> You could just not implement the on_draw() event. Just rename your
>> on_draw() to some other name, and don't decorate it as the on_draw() event,
>> and then just call it when you want to.
> To post to this group, send email to pyglet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> pyglet-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyglet-users?hl=en.
> Hi Quoc,
> I see no strange flickering except with higher blinking rates. This is
> normal because a normal computer monitor will only refresh 60 times
> per second, so it can't blink at the perfect rate and will instead
> cause irregular blinking.
> So this is a hardware limitation, nothing to do with pyglet (if I
> understand correctly).
> On 25 October 2012 00:14, hotelCA <it.is.t...@gmail.com> wrote:
> > Hi Nathan,
> > I have attached a modified code, using your advice. It now flickers
> totally
> > randomly. I don't know what's wrong. Could you take a look at the code
> and
> > point out what I have done wrong?
> > Thanks,
> > Quoc
> > On Monday, October 22, 2012 11:00:18 AM UTC-5, Nathan wrote:
> >> On Fri, Oct 19, 2012 at 2:29 PM, hotelCA <it.is...@gmail.com> wrote:
> >>> Hi, so basically I have an application with a square in the middle that
> >>> blinks at a certain frequency. The frequency is determined by
> >>> pyglet.clock.schedule_interval(Blinker, Rate). It basically calls the
> >>> function Blinker at the time interval of Rate. Now, I have
> @window.event
> >>> section, where I have defined on_draw(). Everything works fine, except
> that
> >>> on_draw() is triggered on every window event, including hovering the
> mouse
> >>> over the window. How do I disable all window events, except the
> function
> >>> call? Thanks.
> >> You could just not implement the on_draw() event. Just rename your
> >> on_draw() to some other name, and don't decorate it as the on_draw()
> event,
> >> and then just call it when you want to.
> > To post to this group, send email to pyglet-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > pyglet-users+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/pyglet-users?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To post to this group, send email to pyglet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> pyglet-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyglet-users?hl=en.