我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用gtk.AccelGroup()。
def __init__(self): global args super(PyApp, self).__init__() self.set_title("Lasersaur") self.resize(1220, 610) self.set_position(gtk.WIN_POS_CENTER) self.connect("destroy", gtk.main_quit) # exit with ctr-q accel_group = gtk.AccelGroup() accel_group.connect_group(ord('q'), gtk.gdk.CONTROL_MASK, gtk.ACCEL_LOCKED, gtk.main_quit) self.add_accel_group(accel_group) self.darea = gtk.DrawingArea() self.darea.connect("expose-event", self.expose) self.add(self.darea) if args.animate: self.timer = True if args.fast: glib.timeout_add(10, self.on_timer) #100fps self.inc = 8 else: glib.timeout_add(40, self.on_timer) #25fps self.inc = 4 self.todraw = self.inc self.show_all()