Well, since I got such an overwhelming response to my previous query (ie.
*nobody*) and attaching to keypress events was brought up recently, I
thought that I'd try again.
>From previous query:
>Okay, I'm trying to get key_press events from a drawing area. My
>solution works only for arrow keys. And then only if they are
>pressed twice in a row. Any ideas what I'm doing wrong?
Thanks,
Andy
<CUT HERE>
#! /usr/bin/env python
from gtk import *
import GDK
(false,true)=(0,1)
def button_impl(win, event):
print event, "b =", event.button, "x =", event.x, "y =", event.y
def key_press_impl(win,event):
print "Key event received:",win,event
def quit(*args):
mainquit()
topwindow = GtkWindow()
topbox = GtkVBox()
topwindow.add(topbox)
topbox.show()
toppane = GtkDrawingArea()
toppane.set_usize(200,200)
topbox.add(toppane)
toppane.show()
toppane.set_events(GDK.ALL_EVENTS_MASK)
toppane.set_flags(CAN_FOCUS)
toppane.connect("button_press_event",button_impl)
toppane.connect("key_press_event",key_press_impl)
topwindow.connect("destroy",quit)
topwindow.connect("delete_event",quit)
topwindow.show()
mainloop()
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk