Reputation: 11070
I want a key press to be mapped with a button click function in Gtk-python, i.e. if Enter
key is pressed, the data-process
function should execute, which is called by pressing the process
button.
Can this be done?
Upvotes: 0
Views: 1220
Reputation: 1
Assuming you are using a gtk.Entry() and a gtk.Button(), I think what you need to do is just connecting the gtk.Entry() to your data-process function like this:
b = gtk.Button("Process")
b.connect("clicked", data-process)
e = gtk.Entry()
e.connect("activate", data-process)
That should do the "Trick".
Hope this helped.
Upvotes: 0
Reputation: 3814
Speculating this might a Gtk.Dialog
, you can set the default response.
gtk_dialog_set_default_response ()
:
Sets the last widget in the dialog's action area with the given response_id as the default widget for the dialog. Pressing "Enter" normally activates the default widget.
Upvotes: 1