<div dir="ltr">Thank you very much.<div><br></div><div>In fact I had already solved the problem and commited when I read your message : my idea was the same than yours, but I've done it with a "lazy initialisation", thanks to a flag self._initialized (boolean).</div>
<div><br></div><div>Thanks :)</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/26 Alan Jhonn Aguiar Schwyn <span dir="ltr"><<a href="mailto:alanjas@hotmail.com" target="_blank">alanjas@hotmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">A patch worth more than 1000 words..<div><br></div><div>In the patch I show "the idea" behind the problem. You can move all code</div><div>that not needs pygame to the __init__ of the Game class.<br>
<br><div><hr>From: <a href="mailto:alanjas@hotmail.com" target="_blank">alanjas@hotmail.com</a><br>To: <a href="mailto:laurent.bernabe@gmail.com" target="_blank">laurent.bernabe@gmail.com</a>; <a href="mailto:sugar-devel@lists.sugarlabs.org" target="_blank">sugar-devel@lists.sugarlabs.org</a><br>
Date: Thu, 26 Sep 2013 15:01:13 -0300<br>Subject: Re: [Sugar-devel] PyGame can be run only once assertion error<br><br>
<div dir="ltr">You can't call pygame.init in the game creation,<div>not worry if you put <span style="font-size:12pt">all code on self._act.show_menu</span><div><br><div><hr>Date: Thu, 26 Sep 2013 17:01:04 +0000<br>From: <a href="mailto:laurent.bernabe@gmail.com" target="_blank">laurent.bernabe@gmail.com</a><br>
To: <a href="mailto:sugar-devel@lists.sugarlabs.org" target="_blank">sugar-devel@lists.sugarlabs.org</a><br>Subject: [Sugar-devel] PyGame can be run only once assertion error<br><br><div dir="ltr"><div>Hello, everyone,</div>
<div><br></div><div>In my project HitTheBalls, which I've just commited the last modifications, I have a bug I that I don't manage to solve.</div><div>
<br></div><div>If I launch the game without sugar, however, it runs fine.</div><div>Also I modified the activity.py in order to fit my main_game module modifications. Maybe that the reason why I have this behaviour (the activity log is not very verbose in my case).</div>
<div><br></div><div>So how can I solve the problem ?</div><div><br></div><div>This is the activity log :<br></div><div><br></div><div>________________________________________________________</div><div>
1380214070.631923 WARNING root: No Gtk.AccelGroup in the top level window.</div><div>Traceback (most recent call last):</div><div> File "/home/broot/sugar-build/activities/HitTheBalls.activity/sugargame/canvas.py", line 40, in _run_pygame_cb</div>
<div> assert pygame.display.get_surface() is None, "PygameCanvas.run_pygame can only be called once."</div><div>AssertionError: PygameCanvas.run_pygame can only be called once.</div><div>1380214073.021442 WARNING root: No Gtk.AccelGroup in the top level window.</div>
<div>Exited with status 0, pid 9045 data (None, <open file '<fdopen>', mode 'w' at 0x1a299c0>, dbus.ByteArray('e2c07f313236150806506c5508b5a987bf6d2b4d', variant_level=1))</div><div>_________________________________________________________________</div>
<div><br></div><div>Regards</div></div>
<br>_______________________________________________
Sugar-devel mailing list
<a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a></div></div></div> </div>
<br>_______________________________________________
Sugar-devel mailing list
<a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a></div></div> </div></div>
<br>_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
<br></blockquote></div><br></div>