Over a million developers have joined DZone.

The New ShortcutEditor for wxPython

DZone's Guide to

The New ShortcutEditor for wxPython

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

I meant to write up a post on this within a week of reading about it, but then things got busy and I forgot. Anyway, there’s a new widget in the wxPython toolkit called the ShortcutEditor. You can read about it on the wxPython mailing list. You’ll probably have to update the agw lib folder on your local drive unless you run from SVN a lot. It may be included in the latest Phoenix builds too, but I’m not sure. If you want to check it out, do the following on the command line (assuming you have svn installed)

svn checkout http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW/agw/

 That will create an “agw” folder in whatever your current directory is. You’ll want to copy that over the top of the one that’s in your wxPython installation. On my machine, it was in the following location: C:\Python27\Lib\site-packages\wx-2.9.3-msw\wx\lib There’s a simple demo application included in the source code. I’m reproducing it here so you can see try running it too:

import wx
import wx.lib.agw.shortcuteditor as SE

class MyFrame(wx.Frame):

def __init__(self, parent):

wx.Frame.__init__(self, parent, -1, "ShortcutEditor Demo")

bar = wx.MenuBar()
menu = wx.Menu()

menu.Append(101, "&Mercury", "This the text in the Statusbar")
menu.Append(102, "&Venus", "")
menu.Append(103, "&Earth", "You may select Earth too")
menu.Append(104, "&Close", "Close this frame")

bar.Append(menu, 'File')

dlg = SE.ShortcutEditor(self)

if dlg.ShowModal() == wx.ID_OK:
# Changes accepted, send back the new shortcuts to the TLW wx.MenuBar


# our normal wxApp-derived class, as usual

app = wx.App(0)

frame = MyFrame(None)


If you run the code above, you should see something like this on your screen:

Then you can start changing short cut keys. I thought it was really cool. According to the file’s internal documentation, it can change menu shortcut keys and AcceleratorTables. You should give it a try sometime. I think this will be a pretty helpful utility to add to my own scripts.

Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}