[pygtk] windows vs linux keypress event

Lang Hurst lang at tharin.com
Wed Jul 7 12:26:39 WST 2010


OK, figured it out.

I was using

    if event.state == gtk.gdk.CONTROL_MASK | gtk.gdk.MOD2_MASK:

and this worked under linux but not windows.  When I changed it to

      if event.state & gtk.gdk.CONTROL_MASK | gtk.gdk.MOD2_MASK:

  if worked under both windows and linux.


On 07/06/2010 04:44 PM, Lang Hurst wrote:
> I have this in my program
>
>     def on_window1_key_event(self, widget, event):
>         print event
>
> It works fine under linux, the terminal prints out things like
>
>     <gtk.gdk.Event at 0x8b525c0: GDK_KEY_PRESS keyval=Control_L>
>     <gtk.gdk.Event at 0x8b525c0: GDK_KEY_PRESS keyval=e>
>     <gtk.gdk.Event at 0x8b525c0: GDK_KEY_PRESS keyval=s>
>
> I do other stuff with the key presses, but it works.  When I try to 
> run the same program under windows, I get output like
>
>     <gdk.Event at 0xce8640>
>     <gdk.Event at 0xce8590>
>     <gdk.Event at 0xce8850>
>
>
> No actual key values come over for me to work with.  Any idea why its 
> doing this?  Basically, I capture CNTRL+key and do stuff with it, 
> based on the window that's showing.
>
> -Lang
>
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/


-- 
There are no stupid questions, just stupid people.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20100706/40399c76/attachment.htm 


More information about the pygtk mailing list