1
我想將accelgroup(鍵盤快捷鍵)添加到Gio.Menu項目中。 但我還沒有找到辦法做到這一點。就像,在這個例子中,我要打開文件,<Ctrl>+o
將鍵盤快捷鍵添加到GIo.Menu
filemenu = Gio.Menu()
filemenu.append("Open","win.open")
accelgroup=Gtk.AccelGroup()
self.add_accel_group(accelgroup)
# Open menu
open_action = Gio.SimpleAction(name="open")
# this line is problematic
open_action.add_accelerator("activate". Gdk._keyval_from_name("O"))
open_action.connect("activate", self.MenuElem.file_open_clicked)
self.add_action(open_action)
我怎樣才能做到這一點?