Hi,
I just tested your code on Windows 10, and I don't get the problems you
describe. My times didn't get about 0.52 seconds haha.

Wonder if it's another gift from Mac OS?

Take care,

Chris Norman



On Fri, 1 Jan 2021 at 11:49, Mathieu <mathieu.dae...@gmail.com> wrote:

> Apologies if this is obviously out of pyglet's scope/objectives.
>
> Function calls triggered by *pyglet.clock.schedule_interval()* seem to
> occur at extremely variable time intervals after the pyglet window is
> hidden/minimized (this is on macOS Catalina, in case it matters).
>
> Below is a minimal example that should print out a number not much greater
> than 0.5 every half second. Instead, after a few seconds of the window
> being minimized, calls are delayed by up to 10 seconds.
>
> I'm (baselessly) assuming this is because pyglet is designed to function
> with lower priority when the window is not visible. I dont really care if
> my functions calls occur every 0.6 seconds instead of 0.5, but a 10s lag
> seems unreasonably large.
>
> Is there a simple way to ensure pyglet maintains a high priority and/or
> does not drastically alter the frequency of scheduled calls?
>
> ----
> import pyglet
> window = pyglet.window.Window(width = 128, height = 128)
>
> @window.event
> def on_draw():
>     window.clear()
>
> def foo(t):
>     print(t)
>
> pyglet.clock.schedule_interval(foo, 0.5)
> pyglet.app.run()
> ----
>
> Typical output below:
>
> ----
> 0.5010913940000137
> 8.22102221900002
> 10.501081690999968
> 10.501448707999998
> 10.501421234999953
> 3.7303194810000377
> 10.501095133000035
> 0.5011976460000369
> 10.501220476999947
> 10.501225187000045
> 4.144422970999926
> ----
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pyglet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyglet-users/b83ecc7f-128f-427f-9430-78157d292d73n%40googlegroups.com
> <https://groups.google.com/d/msgid/pyglet-users/b83ecc7f-128f-427f-9430-78157d292d73n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyglet-users/CANjhqb8-vQRR%2BJ4Q_f%2Bg16NF475yueBFMt_y%2BGUVhTMskPmHzQ%40mail.gmail.com.

Reply via email to