[Sugar-devel] PyGame/ Sugargame issues with GTK 3
Alan Jhonn Aguiar Schwyn
alanjas at hotmail.com
Wed Feb 19 16:13:37 EST 2014
James:
I'm interesting in make that changes. I have a lot of activities written in PyGame that could needthat improve. Generally, I only use mouse events and arrows.After, we can update the GIT sugargame with this changes.I have a few commits to GTK-2 branch to send.
Regards!
Alan
Date: Wed, 19 Feb 2014 10:19:55 -0600
From: nicestep at gmail.com
To: manuq at laptop.org
CC: alanjas at hotmail.com; sugar-devel at lists.sugarlabs.org
Subject: Re: [Sugar-devel] PyGame/ Sugargame issues with GTK 3
Manuel,
I am aware of the test Activity. I wrote this chapter on using PyGame to develop Activities:
http://en.flossmanuals.net/make-your-own-sugar-activities/making-activities-using-pygame/
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.
James Simmons
On Wed, Feb 19, 2014 at 5:56 AM, Manuel Quiñones <manuq at laptop.org> wrote:
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 ..
_______________________________________________
Sugar-devel mailing list
Sugar-devel at lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20140219/646a18d2/attachment-0001.html>
More information about the Sugar-devel
mailing list