<div dir="ltr">PyGame do not integrate well with gtk, and at least some one invest a good time<div>and solve the issues, will continue out of sugar.</div><div><br></div><div>Gonzalo</div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Wed, Feb 19, 2014 at 1:19 PM, James Simmons <span dir="ltr"><<a href="mailto:nicestep@gmail.com" target="_blank">nicestep@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Manuel,<div><br></div><div>I am aware of the test Activity. I wrote this chapter on using PyGame to develop Activities:</div><div><br></div><div><a href="http://en.flossmanuals.net/make-your-own-sugar-activities/making-activities-using-pygame/" target="_blank">http://en.flossmanuals.net/make-your-own-sugar-activities/making-activities-using-pygame/</a><br>
</div><div><br></div><div>The code changes to sugargame to make it recognize the plus and minus keys aren't hard to figure out, and I could correct my personal copy of sugargame. I was a bit surprised to find that while so much has changed in Sugar since I wrote the book but sugargame still isn't an official part of the Sugar API. It's been a couple of years now.</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>James Simmons</div><div><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 19, 2014 at 5:56 AM, Manuel Quiñones <span dir="ltr"><<a href="mailto:manuq@laptop.org" target="_blank">manuq@laptop.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2014-02-19 6:26 GMT-03:00 James Simmons <<a href="mailto:nicestep@gmail.com" target="_blank">nicestep@gmail.com</a>>:<br>
<div>> It occurs to me to ask if sugargame is still something you need to copy the<br>
> code into your activity to use or if it is part of sugar proper. I'm still<br>
> taking the latest code and copying it in.<br>
<br>
</div>Yes, you need to copy sugargame inside your activity.<br>
<br>
Inside sugargame repository there is a test Activity<br>
<a href="https://git.sugarlabs.org/sugargame/mainline/trees/master/test" target="_blank">https://git.sugarlabs.org/sugargame/mainline/trees/master/test</a><br>
<br>
It displays a bouncing ball. You should be able to change the ball<br>
direction with left and right arrows. Can you test the activity?<br>
<br>
Note that you should use PyGame events, not GTK+. The demo listens to<br>
pygame.KEYDOWN event in pygame.K_LEFT and pygame.K_RIGHT.<br>
<div><div><br>
><br>
> James Simmons<br>
><br>
><br>
><br>
> On Wed, Feb 19, 2014 at 2:52 AM, James Simmons <<a href="mailto:nicestep@gmail.com" target="_blank">nicestep@gmail.com</a>> wrote:<br>
>><br>
>> Alan,<br>
>><br>
>> Grabbing focus definitely helped. I get the arrow keys now. However, I<br>
>> also use the plus and minus keys and I still don't get them. In the logs I<br>
>> see these messages:<br>
>><br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key Num_Lock unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key Scroll_Lock unrecognized<br>
>> Key Scroll_Lock unrecognized<br>
>> Key Scroll_Lock unrecognized<br>
>> Key Scroll_Lock unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_8 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_2 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_4 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_6 unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Subtract unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>> Key KP_Add unrecognized<br>
>><br>
>> This is not coming from my code. I see a Translator class in<br>
>> sugargame/events.py that may be the culprit.<br>
>><br>
>> James Simmons<br>
>><br>
>><br>
>><br>
>> On Tue, Feb 18, 2014 at 6:37 PM, Alan Jhonn Aguiar Schwyn<br>
>> <<a href="mailto:alanjas@hotmail.com" target="_blank">alanjas@hotmail.com</a>> wrote:<br>
>>><br>
>>> Hi,<br>
>>><br>
>>> The problem of no keyboards events appears in GTK-2 too.<br>
>>> Maybe you need "grab_focus" to get them. See the function:<br>
>>><br>
>>> _pygamecanvas.grab_focus()<br>
>>><br>
>>> This is my code for Conozco America activity:<br>
>>><br>
>>> self.actividad = conozco.Conozco(self)<br>
>>> self._pygamecanvas = sugargame.canvas.PygameCanvas(self)<br>
>>> self.set_canvas(self._pygamecanvas)<br>
>>> self._pygamecanvas.grab_focus()<br>
>>> self._pygamecanvas.run_pygame(self.actividad.principal)<br>
>>><br>
>>><br>
>>> > Date: Wed, 19 Feb 2014 09:03:58 +1100<br>
>>> > From: <a href="mailto:quozl@laptop.org" target="_blank">quozl@laptop.org</a><br>
>>> > To: <a href="mailto:sugar-devel@lists.sugarlabs.org" target="_blank">sugar-devel@lists.sugarlabs.org</a><br>
>>> > Subject: Re: [Sugar-devel] PyGame/ Sugargame issues with GTK 3<br>
>>><br>
>>> ><br>
>>> > G'day James,<br>
>>> ><br>
>>> > I've not seen this problem myself, nor have I tried, but I shall<br>
>>> > speculate:<br>
>>> ><br>
>>> > - make sure the window has focus; without focus the events may not be<br>
>>> > delivered, and I have a vague memory of focus manipulation in one of<br>
>>> > the pygame/gtk toolkits,<br>
>>> ><br>
>>> > - add code to sugargame temporarily to print received events, in an<br>
>>> > attempt to diagnose which half of the stack is misbehaving.<br>
>>> ><br>
>>> > --<br>
>>> > James Cameron<br>
>>> > <a href="http://quozl.linux.org.au/" target="_blank">http://quozl.linux.org.au/</a><br>
>>> > _______________________________________________<br>
>>> > Sugar-devel mailing list<br>
>>> > <a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">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>
>>> _______________________________________________<br>
>>> Sugar-devel mailing list<br>
>>> <a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">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>
>><br>
><br>
><br>
> _______________________________________________<br>
> Sugar-devel mailing list<br>
> <a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">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>
<br>
<br>
<br>
</div></div><span><font color="#888888">--<br>
.. manuq ..<br>
</font></span></blockquote></div><br></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><br clear="all"><div><br></div>-- <br><div dir="ltr">Gonzalo Odiard<br><br><div>SugarLabs - Learning Software for children<br></div></div>
</div>