I tried to give this a test on my old Windows laptop, but unfortunately the 
graphics chipset doesn's support shared contexts, so I can't do more than 
one Window.. 

If you give it a try with the **pyglet.options['debug_win32'] = True** 
option set, does it reveal anything useful?
Also, I'd give it a try in the REPL, by manually typing everything in. 
Basically just trying manually without the While loop: create two windows, 
and switching to each.

I'll have access to a modern laptop with Win 7 in about a week or so, at 
which time I can try to replicate/fix this.

-Ben

On Tuesday, July 11, 2017 at 11:43:49 PM UTC+9, Hugo Gagnon wrote:
>
> The code outputs: 
>
> Clock ticked 
> switched to window Figure(width=640, height=480) 
>
> and then hangs, i.e. the windows become unresponsive. Closing them don't 
> work. Closing the Anaconda Windows prompt does. 
>
> -- 
>   Hugo Gagnon 
>
> On Tue, Jul 11, 2017, at 03:56, Benjamin Moran wrote: 
> > There are several debug flags that can be set in pyglet that might help 
> > with debugging this, but I would first suggest a quick poor-man's 
> > debugging, and just throw a few print statements in there. Give the 
> > following a try. It will either tell us where it's hanging, or if it's 
> > another issue such as the windows just not being displayed. It'll at 
> least 
> > be a start to find out where the issue is. 
> > 
> > import time 
> > import pyglet 
> > 
> > class Figure(pyglet.window.Window): 
> >     ID = 0 
> >     def __init__(self): 
> >         Figure.ID += 1 
> >         super(Figure, self).__init__(caption='fig' + str(Figure.ID)) 
> >         self.fps = pyglet.clock.ClockDisplay() 
> >     def on_draw(self): 
> >         self.clear() 
> >         self.fps.draw() 
> > 
> > fig1 = Figure() 
> > fig2 = Figure() 
> > 
> > 
> > while True: 
> >     pyglet.clock.tick() 
> >     print("Clock ticked") 
> > 
> >     for window in pyglet.app.windows: 
> >         window.switch_to() 
> >         print("switched to window {0}".format(window)) 
> >         window.dispatch_events() 
> >         print("dispatched events") 
> >         window.dispatch_event('on_draw') 
> >         print("dispatched on_draw event") 
> >         window.flip() 
> >         print("flipped window\n") 
> >     time.sleep(1) 
> > 
> > 
> > 
> > 
> > On Thursday, July 6, 2017 at 10:36:11 PM UTC+9, Hugo Gagnon wrote: 
> > > 
> > > Hi Benjamin, 
> > > 
> > > Yes, I meant Pyglet 1.2.4 ;) 
> > > 
> > > I tried changing "Figure()" for "figX = Figure()" and that didn't 
> work. 
> > > Yes, that's a bit embarrassing. 
> > > 
> > > Thanks, 
> > > 
> > > -- 
> > >   Hugo Gagnon 
> > > 
> > > On Wed, Jul 5, 2017, at 21:07, Benjamin Moran wrote: 
> > > > Hi Hugo, 
> > > > 
> > > > Are you sure you don't mean pyglet v1.2.4? :) 
> > > > I tried this on my Linux machine, and both cases worked perfectly 
> > > (python2 
> > > > and 3, pyglet 1.2.4). 
> > > > Maybe it's something simple, like the Window instances being garbage 
> > > > collected. 
> > > > Does this have any effect? 
> > > > 
> > > > fig1 = Figure() 
> > > > fig2 = Figure() 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > On Thursday, July 6, 2017 at 1:55:49 AM UTC+9, Hugo Gagnon wrote: 
> > > > > 
> > > > > Hi, 
> > > > > 
> > > > > The following snippet works fine: 
> > > > > 
> > > > > import pyglet 
> > > > >> class Figure(pyglet.window.Window): 
> > > > > 
> > > > >     ID = 0 
> > > > >>     def __init__(self): 
> > > > >>         Figure.ID += 1 
> > > > >>         super(Figure, self).__init__(caption='fig' + 
> str(Figure.ID)) 
> > > > >>         self.fps = pyglet.clock.ClockDisplay() 
> > > > >>     def on_draw(self): 
> > > > >>         self.clear() 
> > > > >>         self.fps.draw() 
> > > > >> Figure() 
> > > > >> Figure() 
> > > > >> pyglet.app.run() 
> > > > > 
> > > > > 
> > > > > However, if I replace "pyglet.app.run()" with my own event loop: 
> > > > > 
> > > > > while True: 
> > > > >>     pyglet.clock.tick() 
> > > > >>     for window in pyglet.app.windows: 
> > > > >>         window.switch_to() 
> > > > >>         window.dispatch_events() 
> > > > >>         window.dispatch_event('on_draw') 
> > > > >>         window.flip() 
> > > > > 
> > > > > 
> > > > > then the application hangs (before you ask: I need to use my own 
> event 
> > > > > loop for my own application). 
> > > > > 
> > > > > I use Anaconda Python 2.7 with Pyglet 1.2.7 on Windows 7. 
> > > > > 
> > > > > Input appreciated! 
> > > > > 
> > > > > Hugo 
> > > > > 
> > > > > 
> > > > 
> > > > -- 
> > > > 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 [email protected] <javascript:>. 
> > > > To post to this group, send email to [email protected] 
> > > <javascript:>. 
> > > > Visit this group at https://groups.google.com/group/pyglet-users. 
> > > > For more options, visit https://groups.google.com/d/optout. 
> > > 
> > 
> > -- 
> > 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 [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/pyglet-users. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to