<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Wich developers?<div><br></div><div>In the documentation must be a paragraph that explain this inconvenient:</div><div><br></div><div><a href="http://wiki.sugarlabs.org/go/Development_Team/Sugargame" target="_blank">http://wiki.sugarlabs.org/go/Development_Team/Sugargame</a><br><br><div>> Date: Fri, 27 Sep 2013 18:32:53 +1000<br>> From: quozl@laptop.org<br>> To: alanjas@hotmail.com<br>> CC: sugar-devel@lists.sugarlabs.org; laurent.bernabe@gmail.com<br>> Subject: Re: [Sugar-devel] PyGame can be run only once assertion error<br>> <br>> Hmm, not terrific, yes. But 100% of the developers who have used<br>> SugarGames in the past nine months have stumbled on it. ;-)<br>> <br>> On Fri, Sep 27, 2013 at 05:19:04AM -0300, Alan Jhonn Aguiar Schwyn wrote:<br>> > I think that is not "terrific" problem.<br>> > The problem must be documented, it's a easy to solve inconvenient.<br>> > In the code, sugargames/canvas.py there are this:<br>> > <br>> > # Preinitialize Pygame with the X window ID.<br>> > assert pygame.display.get_init() == False, "Pygame must not be initialized<br>> > before calling PygameCanvas.run_pygame."<br>> > <br>> > <br>> > > Date: Fri, 27 Sep 2013 17:14:58 +1000<br>> > > From: quozl@laptop.org<br>> > > To: alanjas@hotmail.com<br>> > > CC: sugar-devel@lists.sugarlabs.org; laurent.bernabe@gmail.com<br>> > > Subject: Re: [Sugar-devel] PyGame can be run only once assertion error<br>> > ><br>> > > Could this be fixed in SugarGames in future?<br>> > ><br>> > > (Not an invitation to discuss deprecation in favour of alternate<br>> > > technologies; clearly it is in use, why can't we fix it?)<br>> > ><br>> > > On Fri, Sep 27, 2013 at 04:07:11AM -0300, Alan Jhonn Aguiar Schwyn wrote:<br>> > > > There are not problem with call "pygame.init" all times that you want (see<br>> > the<br>> > > > documentation).<br>> > > > The problem is call outside of self._pygamecanvas.run_pygame function.<br>> > > > It's one thing of SugarGames.<br>> > > ><br>> > > > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br>> > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br>> > ━━━<br>> > > > Date: Fri, 27 Sep 2013 09:03:25 +0200<br>> > > > Subject: Re: [Sugar-devel] PyGame can be run only once assertion error<br>> > > > From: laurent.bernabe@gmail.com<br>> > > > To: alanjas@hotmail.com<br>> > > > CC: sugar-devel@lists.sugarlabs.org<br>> > > ><br>> > > > Thank you very much.<br>> > > ><br>> > > > In fact I had already solved the problem and commited when I read your<br>> > message<br>> > > > : my idea was the same than yours, but I've done it with a "lazy<br>> > > > initialisation", thanks to a flag self._initialized (boolean).<br>> > > ><br>> > > > Thanks :)<br>> > > ><br>> > > ><br>> > > > 2013/9/26 Alan Jhonn Aguiar Schwyn <alanjas@hotmail.com><br>> > > ><br>> > > > A patch worth more than 1000 words..<br>> > > ><br>> > > > In the patch I show "the idea" behind the problem. You can move all code<br>> > > > that not needs pygame to the __init__ of the Game class.<br>> > > ><br>> > > > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br>> > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br>> > > > From: alanjas@hotmail.com<br>> > > > To: laurent.bernabe@gmail.com; sugar-devel@lists.sugarlabs.org<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>> > > > You can't call pygame.init in the game creation,<br>> > > > not worry if you put all code on self._act.show_menu<br>> > > ><br>> > > > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br>> > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br>> > > > Date: Thu, 26 Sep 2013 17:01:04 +0000<br>> > > > From: laurent.bernabe@gmail.com<br>> > > > To: sugar-devel@lists.sugarlabs.org<br>> > > > Subject: [Sugar-devel] PyGame can be run only once assertion error<br>> > > ><br>> > > > Hello, everyone,<br>> > > ><br>> > > > In my project HitTheBalls, which I've just commited the last modifications,<br>> > > > I have a bug I that I don't manage to solve.<br>> > > ><br>> > > > If I launch the game without sugar, however, it runs fine.<br>> > > > Also I modified the activity.py in order to fit my main_game module<br>> > > > modifications. Maybe that the reason why I have this behaviour (the<br>> > > > activity log is not very verbose in my case).<br>> > > ><br>> > > > So how can I solve the problem ?<br>> > > ><br>> > > > This is the activity log :<br>> > > ><br>> > > > ________________________________________________________<br>> > > > 1380214070.631923 WARNING root: No Gtk.AccelGroup in the top level window.<br>> > > > Traceback (most recent call last):<br>> > > > File "/home/broot/sugar-build/activities/HitTheBalls.activity/sugargame/<br>> > > > canvas.py", line 40, in _run_pygame_cb<br>> > > > assert pygame.display.get_surface() is None, "PygameCanvas.run_pygame<br>> > > > can only be called once."<br>> > > > AssertionError: PygameCanvas.run_pygame can only be called once.<br>> > > > 1380214073.021442 WARNING root: No Gtk.AccelGroup in the top level window.<br>> > > > Exited with status 0, pid 9045 data (None, <open file '<fdopen>', mode 'w'<br>> > > > at 0x1a299c0>, dbus.ByteArray('e2c07f313236150806506c5508b5a987bf6d2b4d',<br>> > > > variant_level=1))<br>> > > > _________________________________________________________________<br>> > > ><br>> > > > Regards<br>> > > ><br>> > > > _______________________________________________ Sugar-devel mailing list<br>> > > > Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/<br>> > > > sugar-devel<br>> > > ><br>> > > > _______________________________________________ Sugar-devel mailing list<br>> > > > Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/<br>> > > > sugar-devel<br>> > > ><br>> > > > _______________________________________________<br>> > > > Sugar-devel mailing list<br>> > > > Sugar-devel@lists.sugarlabs.org<br>> > > > http://lists.sugarlabs.org/listinfo/sugar-devel<br>> > > ><br>> > > ><br>> > > ><br>> > ><br>> > > > _______________________________________________<br>> > > > Sugar-devel mailing list<br>> > > > Sugar-devel@lists.sugarlabs.org<br>> > > > http://lists.sugarlabs.org/listinfo/sugar-devel<br>> > ><br>> > ><br>> > > --<br>> > > James Cameron<br>> > > http://quozl.linux.org.au/<br>> > > _______________________________________________<br>> > > Sugar-devel mailing list<br>> > > Sugar-devel@lists.sugarlabs.org<br>> > > http://lists.sugarlabs.org/listinfo/sugar-devel<br>> <br>> -- <br>> James Cameron<br>> http://quozl.linux.org.au/<br>> _______________________________________________<br>> Sugar-devel mailing list<br>> Sugar-devel@lists.sugarlabs.org<br>> http://lists.sugarlabs.org/listinfo/sugar-devel<br></div></div> </div></body>
</html>