Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop gtk.Entry from losing focus on arrow keypress?

I'm writing a Python GTK app that uses a gtk.Entry widget to forward keypresses to multiple other widgets. Unfortunately, it seems like GTK has a default binding that switches widget focus on the up and down arrow keys out of the Entry widget.

I want to disconnect this key-based focus switching, but leave mouse based focus switching in place. I can't seem to find where in the API I'd do this.

Any suggestions?

like image 904
Graeme Avatar asked Oct 20 '25 15:10

Graeme


1 Answers

Return True from a handler for the key-press-event signal to prevent the default handling: http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#signal-gtkwidget--key-press-event

like image 150
Esme Povirk Avatar answered Oct 22 '25 05:10

Esme Povirk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!