Пример #1
0
 def test_accelTable1(self):
     tbl = wx.AcceleratorTable([ wx.AcceleratorEntry(wx.ACCEL_ALT,    ord('X'),   123),
                                 wx.AcceleratorEntry(wx.ACCEL_CTRL,   ord('H'),   234),
                                 wx.AcceleratorEntry(wx.ACCEL_CTRL,   ord('F'),   345),
                                 wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F3,  456)
                                 ])
     self.frame.SetAcceleratorTable(tbl)
Пример #2
0
 def InitAccelerators(self):
     # Set up accelerators
     accelC = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('C'), wx.ID_COPY)
     accelV = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('V'), wx.ID_PASTE)
     accelB = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('B'), self.brkItemID)
     accel = wx.AcceleratorTable([accelC, accelV, accelB])
     self.frame.SetAcceleratorTable(accel)
Пример #3
0
 def _createAccelTable(self):
     accel = wx.AcceleratorTable([
         wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F1, id_new_patient),
         wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F2, id_new_visit),
         wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F3, id_save_visit),
         wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F5, wx.ID_REFRESH),
         wx.AcceleratorEntry(wx.ACCEL_ALT, wx.WXK_F4, wx.ID_EXIT)
     ])
     self.SetAcceleratorTable(accel)
Пример #4
0
    def _add_accelerator(self):
        """ Set the accelerator table. """

        # Save with CTRL+S
        accelS = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('S'), wx.ID_SAVE)

        # Save all with CTRL+SHIFT+S
        accelSS = wx.AcceleratorEntry(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('S'), SAVE_ALL_ID)
        
        # Quit with ATL+F4
        accelQ = wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F4, wx.ID_EXIT)

        accel_tbl = wx.AcceleratorTable([ accelQ, accelS, accelSS ])
        self.SetAcceleratorTable(accel_tbl)
Пример #5
0
 def __init__(self, source, valid_id_map=None):
     entries = {}
     try:
         desc = source.keybinding_desc.items()
     except AttributeError:
         log.debug(f"No keybinding description found in {source}")
     else:
         for action_key, text in desc:
             if not text:
                 continue
             a = wx.AcceleratorEntry()
             a.FromString(text)
             # print(f"{a.ToString()}: {action_key} flags={a.GetFlags()} keycode={a.GetKeyCode()}")
             if a.IsOk():
                 try:
                     action = source.calc_usable_action(action_key)
                 except KeyError:
                     log.debug(f"action {action_key} not used in source {source}")
                     pass
                 else:
                     key_id = (a.GetFlags(), a.GetKeyCode())
                     if valid_id_map is not None:
                         id = get_action_id(action_key)
                         if id in valid_id_map:
                             log.debug(f"action {action_key} already in menubar: id={id}")
                             key_id = None
                     if key_id is not None:
                         entries[key_id] = (action_key, action)
             else:
                 log.error(f"Invalid key binding {text} for {action_key} in {source.name}")
     self.valid_key_map = entries
Пример #6
0
    def Init(self):
        self.Bind(wx.EVT_BUTTON, self.BtnSearchClick, self.btnSearch)
        self.Bind(wx.EVT_BUTTON, self.BtnDownloadClick, self.btnDownload)
        self.Bind(wx.EVT_BUTTON, self.BtnPathClick, self.btnPath)
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # 設定快速鍵
        entries = [wx.AcceleratorEntry() for i in range(3)]
        entries[0].Set(wx.ACCEL_ALT, ord('S'), self.btnSearch.GetId())
        entries[1].Set(wx.ACCEL_ALT, ord('D'), self.btnDownload.GetId())
        entries[2].Set(wx.ACCEL_ALT, ord('P'), self.btnPath.GetId())
        table = wx.AcceleratorTable(entries)
        self.SetAcceleratorTable(table)

        # 載入 chromedriver
        opt = Options()
        # opt.add_argument('--headless')
        opt.add_argument('--disable-gpu')
        # opt.add_experimental_option('excludeSwitches', ['enable-loggin'])
        self.web = webdriver.Chrome('chromedriver.exe', options=opt)

        # 選取硬碟
        disk = []
        for i in win32api.GetLogicalDriveStrings().split('\000'):
            if win32file.GetDriveType(i) == 3:
                disk.append(i[:-2])
        # print(disk)
        if not os.path.isdir(self.lblPath.GetLabelText()):
            os.mkdir(self.lblPath.GetLabelText())
        self.lblPath.SetLabelText('{0}:\mp3_tmp'.format(disk[len(disk) - 1]))
Пример #7
0
 def makeAccelTable(self):
     """Makes a standard accelorator table and returns it. This then needs
     to be set for the Frame using self.SetAccelerator(table)
     """
     def parseStr(inStr):
         accel = 0
         if 'ctrl' in inStr.lower():
             accel += wx.ACCEL_CTRL
         if 'shift' in inStr.lower():
             accel += wx.ACCEL_SHIFT
         if 'alt' in inStr.lower():
             accel += wx.ACCEL_ALT
         return accel, ord(inStr[-1])
     # create a list to link IDs to key strings
     keyCodesDict = {}
     keyCodesDict[self.keys['copy']] = wx.ID_COPY
     keyCodesDict[self.keys['cut']] = wx.ID_CUT
     keyCodesDict[self.keys['paste']] = wx.ID_PASTE
     keyCodesDict[self.keys['undo']] = wx.ID_UNDO
     keyCodesDict[self.keys['redo']] = wx.ID_REDO
     keyCodesDict[self.keys['save']] = wx.ID_SAVE
     keyCodesDict[self.keys['saveAs']] = wx.ID_SAVEAS
     keyCodesDict[self.keys['close']] = wx.ID_CLOSE
     keyCodesDict[self.keys['redo']] = wx.ID_REDO
     keyCodesDict[self.keys['quit']] = wx.ID_EXIT
     # parse the key strings and convert to accelerator entries
     entries = []
     for keyStr, code in list(keyCodesDict.items()):
         mods, key = parseStr(keyStr)
         entry = wx.AcceleratorEntry(mods, key, code)
         entries.append(entry)
     table = wx.AcceleratorTable(entries)
     return table
Пример #8
0
    def _init_ctrls(self, prnt):
        wx.Frame.__init__(self,
                          id=wx.ID_ANY,
                          name='objdictedit',
                          parent=prnt,
                          pos=wx.Point(149, 178),
                          size=wx.Size(1000, 700),
                          style=wx.DEFAULT_FRAME_STYLE,
                          title=_('Objdictedit'))
        self._init_utils()
        self.SetClientSize(wx.Size(1000, 700))
        self.SetMenuBar(self.MenuBar)
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        if not self.ModeSolo:
            self.Bind(wx.EVT_MENU, self.OnSaveMenu, id=wx.ID_SAVE)
            accel = wx.AcceleratorTable(
                [wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, wx.ID_SAVE)])
            self.SetAcceleratorTable(accel)

        self.FileOpened = wx.Notebook(id=wx.ID_ANY,
                                      name='FileOpened',
                                      parent=self,
                                      pos=wx.Point(0, 0),
                                      size=wx.Size(0, 0),
                                      style=0)
        self.FileOpened.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
                             self.OnFileSelectedChanged)

        self.HelpBar = wx.StatusBar(id=wx.ID_ANY,
                                    name='HelpBar',
                                    parent=self,
                                    style=wx.STB_SIZEGRIP)
        self._init_coll_HelpBar_Fields(self.HelpBar)
        self.SetStatusBar(self.HelpBar)
Пример #9
0
    def _init_ctrls(self, prnt):
        wx.Frame.__init__(self,
                          id=ID_NETWORKEDIT,
                          name='networkedit',
                          parent=prnt,
                          pos=wx.Point(149, 178),
                          size=wx.Size(1000, 700),
                          style=wx.DEFAULT_FRAME_STYLE,
                          title=_('Networkedit'))
        self._init_utils()
        self.SetClientSize(wx.Size(1000, 700))
        self.SetMenuBar(self.MenuBar)
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        if not self.ModeSolo:
            self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
            accel = wx.AcceleratorTable(
                [wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, wx.ID_SAVE)])
            self.SetAcceleratorTable(accel)

        NetworkEditorTemplate._init_ctrls(self, self)

        self.HelpBar = wx.StatusBar(id=ID_NETWORKEDITHELPBAR,
                                    name='HelpBar',
                                    parent=self,
                                    style=wx.ST_SIZEGRIP)
        self._init_coll_HelpBar_Fields(self.HelpBar)
        self.SetStatusBar(self.HelpBar)
Пример #10
0
 def _update_accerelator_table(self):
     accerelators = []
     for delegator in self._actions.values():
         flags, key_code = delegator.shortcut.parse()
         accerelators.append(
             wx.AcceleratorEntry(flags, key_code, delegator.id))
     self._frame.SetAcceleratorTable(wx.AcceleratorTable(accerelators))
Пример #11
0
 def _set_menu_accelerators(self):
     entries = []
     for menu_id, shortcut in KEYBOARD_SHORTCUTS.items():
         accel = wx.AcceleratorEntry(cmd=menu_id)
         accel.FromString(shortcut)
         entries.append(accel)
     self.SetAcceleratorTable(wx.AcceleratorTable(entries))
Пример #12
0
 def AddItemsWithHotKey(self, *items):
     frame = self.GetTopLevelParent()
     sizer = self.GetSizer()
     orientation = (wx.VERTICAL | wx.HORIZONTAL) ^ sizer.GetOrientation()
     for item in items:
         if item == "|":
             sizer.Add(Separator(self, orientation=orientation),
                       self.SizerFlags1)
         elif isinstance(item, int):
             sizer.Add(item, item, item == -1)
         else:
             tType, key, func, flags, keyCode, *extra = item
             tool = ToolTypes[tType](self,
                                     size=self.ItemSize,
                                     tag=self.L[key],
                                     pics=self.R[key],
                                     func=func,
                                     **(extra[0] if extra else {}))
             tool.SetTip(frame.SetStatus)
             sizer.Add(tool, self.SizerFlags2)
             self[key] = tool
             self._Tools.append(tool)
             cmd = wx.NewId()
             frame.Bind(wx.EVT_MENU, tool.Click, id=cmd)
             frame.AcceleratorEntries.append(
                 wx.AcceleratorEntry(flags=flags, keyCode=keyCode, cmd=cmd))
     sizer.Add(1, 1)
Пример #13
0
 def SetMenuAccel(self, the_item, the_key, the_id):
     #wx.MenuItem.SetAccel(
     #print GetKeyName(the_key)
     try:
         the_item.SetAccel(
             wx.AcceleratorEntry(wx.ACCEL_NORMAL, the_key, the_id))
     except Exception, expt:
         print 'hotkeys:' + str(Exception) + str(expt)
Пример #14
0
def get_accentry_by_id(action_id):
    if action_id in ACC_KEYS:
        items = ACC_KEYS[action_id]
        if isinstance(items, list):
            menu_item = items[0]
            global_items = items[1:]
        else:
            menu_item = items
            global_items = []
        menu_entry = None
        global_entries = []
        if menu_item:
            menu_entry = wx.AcceleratorEntry(*(menu_item + (action_id, )))
        if global_items:
            for item in global_items:
                entry = wx.AcceleratorEntry(*(item + (action_id, )))
                global_entries.append(entry)
        return menu_entry, global_entries
    return None, []
Пример #15
0
 def _set_menu_accelerators(self):
     entries = []
     k_shortcuts = KEYBOARD_SHORTCUTS.copy()
     k_shortcuts.update(
         wx.GetApp().service_handler.get_keyboard_shortcuts())
     for menu_id, shortcut in k_shortcuts.items():
         accel = wx.AcceleratorEntry(cmd=menu_id)
         accel.FromString(shortcut)
         entries.append(accel)
     self.SetAcceleratorTable(wx.AcceleratorTable(entries))
Пример #16
0
 def _update_accerelator_table(self):
     accerelators = []
     for delegator in self._actions.values():
         # print("DEBUG: actiontrigger updateacelerators  delegator %s" % delegator)
         try:
             flags, key_code = delegator.shortcut.parse()
         except TypeError:
             continue
         accerelators.append(wx.AcceleratorEntry(flags, key_code, delegator.id))
     self._frame.SetAcceleratorTable(wx.AcceleratorTable(accerelators))
 def __init__(self, parent):
     wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
     self.parent = parent
     self.createLayout()
     self.Bind(wx.EVT_MENU, self.onQuit, id=123)
     self.Bind(wx.EVT_MENU, self.toggleCheckbox, id=456)
     entries = [wx.AcceleratorEntry() for i in range(3)]
     entries[0].Set(wx.ACCEL_CTRL, ord('N'), 1)
     entries[1].Set(wx.ACCEL_CTRL, ord('A'), 456)
     entries[2].Set(wx.ACCEL_CTRL, ord('W'), 123)
     accel = wx.AcceleratorTable(entries)
Пример #18
0
 def __init__(self):
     super().__init__(parent=None, size=(1020, 900))
     self.html = wxhtml.WebView.New(self)
     # dit werkt niet
     # self.Bind(wx.EVT_KEY_UP, self.on_key)
     # en dit werkte ook niet tot ik ontdekte dat de Bind aanroep ontbrak
     menuitem = wx.MenuItem(None, text='exit')
     self.Bind(wx.EVT_MENU, self.close, menuitem)
     accel = wx.AcceleratorEntry(cmd=menuitem.GetId())
     if accel.FromString('Escape'):
         self.SetAcceleratorTable(wx.AcceleratorTable([accel]))
Пример #19
0
    def __init__(self, datepicker, previous, next_):
        self.previous = previous
        self.datepicker = datepicker
        self.next = next_

        ID_PREVIOUS = wx.NewId()
        ID_NEXT = wx.NewId()
        datepicker.Bind(wx.EVT_BUTTON, self._focus_previous, id=ID_PREVIOUS)
        datepicker.Bind(wx.EVT_BUTTON, self._focus_next, id=ID_NEXT)

        accels = [
            wx.AcceleratorEntry(wx.ACCEL_SHIFT, wx.WXK_TAB, ID_PREVIOUS),
            wx.AcceleratorEntry(wx.ACCEL_CTRL | wx.ACCEL_SHIFT, wx.WXK_TAB,
                                ID_PREVIOUS),
            wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_TAB, ID_NEXT),
            wx.AcceleratorEntry(wx.ACCEL_CTRL, wx.WXK_TAB, ID_NEXT),
        ]

        acctable = wx.AcceleratorTable(accels)
        datepicker.SetAcceleratorTable(acctable)
Пример #20
0
    def add_accelerator(self, callback, key):
        """
        Add a keyboard shortcut, e.g. Ctrl+R for reload
        """
        new_id = wx.NewId()
        self.Bind(wx.EVT_MENU, callback, id=new_id)
        ae = wx.AcceleratorEntry()
        ae.Set(wx.ACCEL_CTRL, ord(key), new_id)
        self.accelerators.append(ae)

        atable = wx.AcceleratorTable(self.accelerators)
        self.SetAcceleratorTable(atable)
Пример #21
0
 def _initAccelTable(self, accelsDescr):
     accelTableEntries = [
         wx.AcceleratorEntry() for n in range(len(accelsDescr[2]))
     ]
     self.accelItemsById = {}
     for numAccel in range(len(accelsDescr[2])):
         accelDescr = accelsDescr[2][numAccel]
         if accelDescr[5] != None:
             self.itemsById[accelDescr[0]] = accelDescr
             accelTableEntries[numAccel].Set(*accelDescr[5], accelDescr[0])
             self.accelItemsById[
                 accelDescr[0]] = accelTableEntries[numAccel]
             self.Bind(wx.EVT_MENU, self.onInput, id=accelDescr[0])
     return accelTableEntries
Пример #22
0
 def _createContextMenu(self):
     context_menu = wx.Menu()
     accelerators = []
     for id, command_dict in self.context_menu_commands.items():
         label = command_dict['label']
         shortcut = command_dict.get('shortcut', None)
         if shortcut:
             accelerator = wx.AcceleratorEntry(cmd=id)
             accelerator.FromString(shortcut)
             accelerators.append(accelerator)
             label = '{0}\t{1}'.format(label, command_dict['shortcut'])
         context_menu.Append(id, label)
     shortcuts = wx.AcceleratorTable(accelerators)
     self._widget.SetAcceleratorTable(shortcuts)
     self.context_menu = context_menu
Пример #23
0
    def __assignHotKeys(self):
        count = min(9, len(self.__buttons))
        entries = [wx.AcceleratorEntry() for n in range(count + 1)]

        for n in range(count):
            if n <= 9:
                entries[n].Set(0, ord('1') + n, self.ID_MIN + n)
                text = u'{n}. {title}'.format(
                    n=n + 1, title=self.__buttons[n].GetLabel())
                self.__buttons[n].SetLabel(text)

        entries[count].Set(0, wx.WXK_ESCAPE, wx.ID_CANCEL)

        accel = wx.AcceleratorTable(entries)
        self.SetAcceleratorTable(accel)
Пример #24
0
 def create_actions(self):
     """define what can be done in this screen
     """
     accel_list = []
     self.actionlist = ((_('a_from'), 'Ctrl+L', self.activate_left),
                        (_('b_tag'), 'Ctrl+Right', self.move_right),
                        (_('a_to'), 'Ctrl+R', self.activate_right),
                        (_('b_untag'), 'Ctrl+Left', self.move_left),
                        (_('b_newtag'), 'Ctrl+N', self.add_trefw))
     for name, shortcut, callback in self.actionlist:
         act = wx.MenuItem(id=wx.NewId(), text=name)
         act.Bind(wx.EVT_MENU, callback)
         accel = wx.AcceleratorEntry(cmd=act.GetId())
         ok = accel.FromString(shortcut)
         if ok:
             accel_list.append(accel)
     accel_table = wx.AcceleratorTable(accel_list)
     self.SetAcceleratorTable(accel_table)
Пример #25
0
    def _updateAcceleratorTables(self):
        # Key - window, value - list of the wx.AcceleratorEntry instances
        entries = {}

        for actionInfo in self._actionsInfo.values():
            if actionInfo.hotkeyId is not None:
                assert actionInfo.hotkey is not None
                entry = wx.AcceleratorEntry(cmd=actionInfo.hotkeyId)
                entry.FromString(str(actionInfo.hotkey))
                if entry.IsOk():
                    if actionInfo.window not in entries:
                        entries[actionInfo.window] = []

                    entries[actionInfo.window].append(entry)

        for window in entries.keys():
            accelTable = wx.AcceleratorTable(entries[window])
            window.SetAcceleratorTable(accelTable)
Пример #26
0
def addItem(menu,
            key,
            id=wx.ID_ANY,
            kind=wx.ITEM_NORMAL,
            checked=False,
            index=None,
            table=None,
            handlerobj=None,
            binder=None):
    accelerators = app.config['accelerators'] if app.config.has_section(
        'accelerators') else {}
    if id == wx.ID_NONE: return
    elif id == wx.ID_SEPARATOR:
        if index is None: return menu.AppendSeparator()
        else: return menu.InsertSeparator(index)
    elif utils.iterable(id):
        return addSubMenu(menu, key, id, index, table, handlerobj, binder)
    if binder is None: binder = win
    if handlerobj is None: handlerobj = binder
    handler = getkey(handlerobj, key)
    if not handler and callable(key): handler = key
    if not handler and callable(handlerobj) and not isinstance(
            handlerobj, type):
        handler = handlerobj
    trArgs = None
    if isinstance(key, tuple): key, *trArgs = key
    if not isinstance(key, str): key = key.__name__
    label = translate(key)
    if trArgs: label = label.format(*trArgs)
    help = translate(key + 'Help', None)
    if help and trArgs: help = help.format(*trArgs)
    shortcut = accelerators.get(key, None)
    if index is None: item = menu.Append(id, label, help, kind)
    else: item = menu.Insert(index, id, label, help, kind)
    if kind != wx.ITEM_NORMAL and checked: item.Check(checked)
    if handler and binder: binder.Bind(wx.EVT_MENU, handler, id=item.GetId())
    if shortcut and table is not None:
        entry = wx.AcceleratorEntry(cmd=item.GetId(), item=item)
        if entry.FromString(shortcut):
            item.SetItemLabel(item.GetItemLabel() + '\t' + entry.ToString())
            table.append(entry)
    return item
Пример #27
0
    def _generate_table(self, window, accelsconf):
        accels = []

        for accstr in accelsconf:
            # An empty string should disable the accelerator
            if accstr:
                action = accelsconf[accstr]

                # action can be either a real ID (integer) or a function
                if isinstance(action, int):
                    id_ = action
                else:
                    id_ = wx.NewId()
                    window.Bind(wx.EVT_BUTTON, action, id=id_)

                accel = wx.AcceleratorEntry(0, 0, id_)
                accel.FromString(accstr)
                accels.append(accel)

        return wx.AcceleratorTable(accels)
Пример #28
0
    def AddMenuItem(self,
                    menu: wx.Menu,
                    text: str,
                    help_text: str,
                    callback: Callable,
                    entries: List,
                    key: Tuple[Any, wx.KeyCode] = None,
                    id_: str = None):
        if id_ is None:
            id_ = wx.NewIdRef(count=1)

        shortcut = ''
        if key is not None:
            entry = wx.AcceleratorEntry(key[0], key[1], id_)
            entries.append(entry)
            shortcut = entry.ToString()

        item = menu.Append(id_, '{}\t{}'.format(text, shortcut), help_text)
        self.Bind(wx.EVT_MENU, callback, item)
        self.menu_events.append((callback, item))
Пример #29
0
 def loadAccels_(accels):
     nonlocal accelTableEntries
     accels_ = []
     for accel in accels:
         if type(accel) == tuple:
             accels_ += accel[1:]
         else:
             accels_ += [accel]
     for accel in accels_:
         if  (not accel in [NID_MENU_SEP, NID_TOOLBAR_HSEP]) \
         and (accel.attrDict["accel"] != None):
             accelTableEntries += [wx.AcceleratorEntry()]
             if accel.attrDict["id"] == None:
                 accel.attrDict["id"] = wx.NewId()
             accelTableEntries[-1].Set(*accel.attrDict["accel"],
                                       accel.attrDict["id"])
             accel.attrDict["accelEntry"] = accelTableEntries[-1]
             self.itemsById[accel.attrDict["id"]] = accel
             self.Bind(wx.EVT_MENU,
                       self.onMenu,
                       id=accel.attrDict["id"])
Пример #30
0
def main() -> None:
    """Main function."""
    app = wx.App()
    pytalk = PyTalk(None)
    entries = [
        (wx.ACCEL_CTRL, ord('N'), pytalk.m_menu_item_file_new.GetId()),
        (wx.ACCEL_CTRL, ord('O'), pytalk.m_menu_item_file_open.GetId()),
        (wx.ACCEL_CTRL, ord('S'), pytalk.m_menu_item_file_save.GetId()),
        (wx.ACCEL_CTRL + wx.ACCEL_ALT, ord('S'),
         pytalk.m_menu_item_file_save_as.GetId()),
        (wx.ACCEL_CTRL, ord('U'),
         pytalk.m_menu_item_command_update_module_list.GetId()),
        (wx.ACCEL_CTRL, ord('D'),
         pytalk.m_menu_item_command_do_selection.GetId()),
        (wx.ACCEL_CTRL + wx.ACCEL_ALT, ord('D'),
         pytalk.m_menu_item_command_do_all.GetId()),
        (wx.ACCEL_CTRL, ord('P'),
         pytalk.m_menu_item_command_print_selection.GetId()),
        (wx.ACCEL_CTRL, ord('L'),
         pytalk.m_menu_item_command_clear_output.GetId()),
        (wx.ACCEL_CTRL, ord('H'),
         pytalk.m_menu_item_command_help_on_selection.GetId()),
        (0, wx.WXK_F1, pytalk.m_menu_item_command_help_on_selection.GetId()),
        (wx.ACCEL_CTRL, ord('F'), pytalk.m_menu_item_tool_find_text.GetId()),
        (wx.ACCEL_CTRL, ord('G'), pytalk.m_menu_item_tool_find_next.GetId()),
        (wx.ACCEL_CTRL, ord('1'), pytalk.m_menu_item_show_file.GetId()),
        (wx.ACCEL_CTRL, ord('2'), pytalk.m_menu_item_show_module.GetId()),
        (wx.ACCEL_CTRL, ord('3'), pytalk.m_menu_item_show_object.GetId()),
        (wx.ACCEL_CTRL, ord('4'), pytalk.m_menu_item_show_code.GetId()),
        (wx.ACCEL_CTRL, ord('5'), pytalk.m_menu_item_show_playground.GetId()),
        (wx.ACCEL_CTRL, ord('6'), pytalk.m_menu_item_show_output.GetId()),
        (wx.ACCEL_CTRL, ord('7'), pytalk.m_menu_item_show_help.GetId()),
    ]
    entries = [
        wx.AcceleratorEntry(flags=flags, keyCode=key_code, cmd=cmd_id)
        for flags, key_code, cmd_id in entries
    ]
    pytalk.SetAcceleratorTable(wx.AcceleratorTable(entries))
    pytalk.Show(True)
    app.MainLoop()