So, this isn't a great suggestion, but you could keep track of all the 
modules in which you change settings, then reload them using the reload 
function from either imp or importlib. imp has been deprecated since 
version 3.4.

Reloading a module will reset all defined objects within it, but it won't 
affect pre-existing objects (so, say, if you modify the sprite class, 
pre-existing sprites won't be affected) or objects from other modules. 
That's why you can't just do reload(pyglet), but you gotta do 
reload(pyglet.clock) and such.

Perhaps, just to be sure, reimport every pyglet submodule ;o

On Thursday, 10 December 2015 02:00:14 UTC-5, Avi Aryan wrote:
>
> This is related to the issue ( 
> https://bitbucket.org/pyglet/pyglet/issues/73/pyglet-crashes-when-starting-a-game-again
>  
> ) I opened on BitBucket..
>
> I wonder if there is a way to reset pyglet such that all settings I have 
> done ( like pyglet.clock.set_fps_limit() ) and all scheduled functions, 
> event handlers and other things are destroyed and pyglet is restored back 
> to its state where it was 'imported'..
> The thing is I have created an app which has a collection of games .
> He can choose any one game to play at a time. After the game play is 
> completed, he can choose any other game..
> This way he can continue playing games one after another ... 
>
> Now when a game is shown, it runs pylget.app.run and in the end it runs 
> pyglet.app.exit .. I also make sure to pop_handlers and delete() all gl 
> stuff.
>
> I thought the whole system will work but the thing crashes after 3 game 
> plays. I get errors like the following.
>
>
> Traceback (most recent call last):
>   File "C:\Users\Avi\Documents\GitHub\BrainGames\braingames.py", line 164, 
> in <module>
>     gameresult = newgame.start()
>   File "C:\Users\Avi\Documents\GitHub\BrainGames\game\gamearea.py", line 
> 64, in start
>     self.show()
>   File "C:\Users\Avi\Documents\GitHub\BrainGames\game\gamearea.py", line 
> 76, in show
>     pyglet.app.run()
>   File "C:\Anaconda3\lib\site-packages\pyglet\app\__init__.py", line 143, 
> in run
>     event_loop.run()
>   File "C:\Anaconda3\lib\site-packages\pyglet\app\base.py", line 136, in 
> run
>     self._run_estimated()
>   File "C:\Anaconda3\lib\site-packages\pyglet\app\base.py", line 175, in 
> _run_estimated
>     if not platform_event_loop.step(estimate) and estimate != 0.0 and \
>   File "C:\Anaconda3\lib\site-packages\pyglet\app\win32.py", line 122, in 
> step
>     _user32.DispatchMessageW(ctypes.byref(msg))
> OSError: exception: priviledged instruction
>
>
>
>   File "C:\Users\Avi\Documents\GitHub\BrainGames\braingames.py", line 164, 
> in <module>
>     gameresult = newgame.start()
>   File "C:\Users\Avi\Documents\GitHub\BrainGames\game\gamearea.py", line 
> 64, in start
>     self.show()
>   File "C:\Users\Avi\Documents\GitHub\BrainGames\game\gamearea.py", line 
> 76, in show
>     pyglet.app.run()
>   File "C:\Anaconda3\lib\site-packages\pyglet\app\__init__.py", line 143, 
> in run
>     event_loop.run()
>   File "C:\Anaconda3\lib\site-packages\pyglet\app\base.py", line 136, in 
> run
>     self._run_estimated()
>   File "C:\Anaconda3\lib\site-packages\pyglet\app\base.py", line 175, in 
> _run_estimated
>     if not platform_event_loop.step(estimate) and estimate != 0.0 and \
>   File "C:\Anaconda3\lib\site-packages\pyglet\app\win32.py", line 122, in 
> step
>     _user32.DispatchMessageW(ctypes.byref(msg))
> OSError: exception: access violation writing 0x00000000003C062A
>
>
>
>

-- 
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 http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to