In a window I'm using keyboard shortcuts, but the shortcuts blocked the entries of my window and don't let me write on them. I have something like this:
self.connect("key-press-event",self._key_press_event, b_finalizar, b_agregar, c_scales, b_buscar, storeCompra,entryCliente, l_total, entry, spinCantidad, spinPrecio, storeAutocomp, tree, l_unidad)
and the event method i have is this:
def _key_press_event(self,widget,event, b_finalizar, b_agregar, c_scales, b_buscar,storeCompra,entryCliente, l_total, entry, spinCantidad, spinPrecio, storeAutocomp, tree, l_unidad):
keyval = event.keyval
keyval_name = Gdk.keyval_name(keyval)
state = event.state
ctrl = (state & Gdk.ModifierType.CONTROL_MASK)
if ctrl and keyval_name == 'a':
self.agregar_clicked(b_agregar, storeCompra, entry, spinCantidad, spinPrecio, storeAutocomp, tree, l_unidad, l_total)
print "AGREGAR ITEM"
elif ctrl and keyval_name == 'b':
print "básculas"
elif ctrl and keyval_name == 'f':
self.finalizar_clicked(b_finalizar, storeCompra, entryCliente, l_total)
print "finalizar"
elif ctrl and keyval_name == 'c':
self.buscar_clicked(b_buscar, entry)
print "catalogo"
return False
return True
I need to be able to write in the entries and use the shortcuts, any idea could be helpful. Thanks
In your last state:
elif ctrl and keyval_name == 'c':
self.buscar_clicked(b_buscar, entry)
print "catalogo"
else:
return False
return True