[Olpc-uruguay] Consultas Pygame

Pablo Moleri pmoleri en gmail.com
Mar Feb 23 22:38:03 EST 2010


Hola! Lo logré!!

Le hice un par de cambios al adaptador y funcionó. Aparentemente el problema
es que hay que setear las máscaras antes de la señal "realize" que viene a
ser cuando se crea el widget para mostrar en pantalla.

Te adjunto el Adaptador modificado. Los cambios son:
    El Translator se crea en el PygameCanvas.__init__()
    Se volvieron a separar los métodos de pygame al Translator.hook_pygame
    Se llama al Translator.hook_pygame desde el run_pygame

Saludos,
Pablo

2010/2/21 Pablo Moleri <pmoleri en gmail.com>

> Hola,
>
> Te mando un modulito de prueba que armé, lo probé en mi laptop (no xo) y
> aparentemente poniendo solo POINTER_MOTION_MASK
> debería mostar todos los eventos relacionados con el movimiento del cursor.
>
> De repente esto te ayuda a ver por qué no está funcionando.
>
> Saludos,
> Pablo
>
>
> On Sun, Feb 21, 2010 at 7:35 PM, Flavio Danesse <fdanesse en gmail.com>wrote:
>
>> Probó todo lo que dices, pero no hay cambio ninguno, eliminé
>> POINTER_MOTION_MASK y POINTER_MOTION_HINT_MASK.
>> Agregué un print en el metodo y solo se ejecuta una vez, cuando se crea la
>> ventana.
>>
>>
>>
>> 2010/2/20 Pablo Moleri <pmoleri en gmail.com>
>>
>>>  Hay un par de cosas raras cuando se inicializan las máscaras, me parece
>>> que la forma de dilucidar bien el comportamiento es mediante prueba y error.
>>>
>>> 1. BUTTON_MOTION_MASK sería lo mismo que POINTER_MOTION_MASK [1]
>>>
>>> 2. POINTER_MOTION_HINT_MASK lo sacaría, me parece que puede ser parte de
>>> tu problema.
>>>
>>> [2] The gtk.gdk.POINTER_MOTION_HINT_MASK is a special mask which is used
>>> to reduce the number of gtk.gdk.MOTION_NOTIFY events received. Normally
>>> a gtk.gdk.MOTION_NOTIFY event is received each time the mouse moves.
>>> However, if the application spends a lot of time processing the event
>>> (updating the display, for example), it can easily lag behind the position
>>> of the mouse. When using the gtk.gdk.POINTER_MOTION_HINT_MASK the server
>>> will only send a single gtk.gdk.MOTION_NOTIFY event (which is marked as
>>> a hint) until the application asks for more, by calling the
>>> gtk.gdk.Window.get_pointer()<http://www.pygtk.org/docs/pygtk/class-gdkwindow.html#method-gdkwindow--get-pointer>method.
>>>
>>> Otra cosa que podés hacer es poner algún print dentro de _mousemove_cb
>>> para ver si los eventos están llegando ahí, pero no al bucle de pygame.
>>>
>>> [1] http://xfc.xfce.org/docs/reference/html/namespaceXfc_1_1Gdk.html
>>> [2] De http://www.pygtk.org/docs/pygtk/class-gdkevent.html
>>>
>>> Saludos,
>>> Pablo
>>>
>>>
>>> _______________________________________________
>>> Olpc-uruguay mailing list
>>> Olpc-uruguay en lists.laptop.org
>>> http://lists.laptop.org/listinfo/olpc-uruguay
>>>
>>>
>>
>> _______________________________________________
>> Olpc-uruguay mailing list
>> Olpc-uruguay en lists.laptop.org
>> http://lists.laptop.org/listinfo/olpc-uruguay
>>
>>
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://lists.laptop.org/pipermail/olpc-uruguay/attachments/20100224/ca3200af/attachment.htm 
------------ próxima parte ------------
Se ha borrado un mensaje que no está en formato texto plano...
Nombre     : AdaptadorPygameSugar.py
Tipo       : text/x-python
Tamaño     : 12080 bytes
Descripción: no disponible
Url        : http://lists.laptop.org/pipermail/olpc-uruguay/attachments/20100224/ca3200af/attachment.py 


More information about the Olpc-uruguay mailing list