[Sugar-devel] PyGame/ Sugargame issues with GTK 3

Manuel Quiñones manuq at laptop.org
Wed Feb 19 06:56:07 EST 2014


2014-02-19 6:26 GMT-03:00 James Simmons <nicestep at gmail.com>:
> It occurs to me to ask if sugargame is still something you need to copy the
> code into your activity to use or if it is part of sugar proper. I'm still
> taking the latest code and copying it in.

Yes, you need to copy sugargame inside your activity.

Inside sugargame repository there is a test Activity
https://git.sugarlabs.org/sugargame/mainline/trees/master/test

It displays a bouncing ball.  You should be able to change the ball
direction with left and right arrows.  Can you test the activity?

Note that you should use PyGame events, not GTK+.  The demo listens to
pygame.KEYDOWN event in pygame.K_LEFT and pygame.K_RIGHT.

>
> James Simmons
>
>
>
> On Wed, Feb 19, 2014 at 2:52 AM, James Simmons <nicestep at gmail.com> wrote:
>>
>> Alan,
>>
>> Grabbing focus definitely helped. I get the arrow keys now. However, I
>> also use the plus and minus keys and I still don't get them. In the logs I
>> see these messages:
>>
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key Num_Lock unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key Scroll_Lock unrecognized
>> Key Scroll_Lock unrecognized
>> Key Scroll_Lock unrecognized
>> Key Scroll_Lock unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_8 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_2 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_4 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_6 unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Subtract unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>> Key KP_Add unrecognized
>>
>> This is not coming from my code. I see a Translator class in
>> sugargame/events.py that may be the culprit.
>>
>> James Simmons
>>
>>
>>
>> On Tue, Feb 18, 2014 at 6:37 PM, Alan Jhonn Aguiar Schwyn
>> <alanjas at hotmail.com> wrote:
>>>
>>> Hi,
>>>
>>> The problem of no keyboards events appears in GTK-2 too.
>>> Maybe you need "grab_focus" to get them. See the function:
>>>
>>> _pygamecanvas.grab_focus()
>>>
>>> This is my code for Conozco America activity:
>>>
>>> self.actividad = conozco.Conozco(self)
>>> self._pygamecanvas = sugargame.canvas.PygameCanvas(self)
>>> self.set_canvas(self._pygamecanvas)
>>> self._pygamecanvas.grab_focus()
>>> self._pygamecanvas.run_pygame(self.actividad.principal)
>>>
>>>
>>> > Date: Wed, 19 Feb 2014 09:03:58 +1100
>>> > From: quozl at laptop.org
>>> > To: sugar-devel at lists.sugarlabs.org
>>> > Subject: Re: [Sugar-devel] PyGame/ Sugargame issues with GTK 3
>>>
>>> >
>>> > G'day James,
>>> >
>>> > I've not seen this problem myself, nor have I tried, but I shall
>>> > speculate:
>>> >
>>> > - make sure the window has focus; without focus the events may not be
>>> > delivered, and I have a vague memory of focus manipulation in one of
>>> > the pygame/gtk toolkits,
>>> >
>>> > - add code to sugargame temporarily to print received events, in an
>>> > attempt to diagnose which half of the stack is misbehaving.
>>> >
>>> > --
>>> > James Cameron
>>> > http://quozl.linux.org.au/
>>> > _______________________________________________
>>> > Sugar-devel mailing list
>>> > Sugar-devel at lists.sugarlabs.org
>>> > http://lists.sugarlabs.org/listinfo/sugar-devel
>>>
>>> _______________________________________________
>>> Sugar-devel mailing list
>>> Sugar-devel at lists.sugarlabs.org
>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>
>>
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>



-- 
.. manuq ..


More information about the Sugar-devel mailing list