[Glade-users] Re: [pygtk] Questions about accelerators.
- From: shevett homeport org (Dave Belfer-Shevett)
- Subject: [Glade-users] Re: [pygtk] Questions about accelerators.
- Date: Fri, 29 Sep 2000 10:56:51 -0400 (EDT)
On Fri, 29 Sep 2000, James Henstridge wrote:
Can you give me a quick code example?
If you just want to do something special for a particular widget, then
using the key_press_event signal is the correct aproach. You look at the
attributes of the event object to see which key was pressed. Return TRUE
if you handled the event yourself, and FALSE otherwise.
Okay, that makes a lot of sense, but I"m having problems wrapping the
event trigger. (sp_sendtext is a gtktext widget)
ta = widgets.get_widget('sp_sendtext')
ta.signal_connect('key_press_event',sendkey)
Which triggers
def sendkey():
print "Key pressed! "
return FALSE
But I get:
[shevett@cheetah]:~/python/spanker/proj1$ ./spanker.py
Traceback (innermost last):
File "/usr/local/lib/python1.5/site-packages/gtk.py", line 125, in
__call__
ret = apply(self.func, a)
TypeError: no arguments expected
Wha'd i do wrong?
Also, could you point me to the structure of an event object?
-------------------. Web-based problem management: www.stonekeep.com
Dave Belfer-Shevett >----------------------------------------------------.
shevett pobox com / Don't byte off more than you can view. (Maxims for \
------------------< the Internet Age) |
\______________________________________________________/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]