I’m doing my first steps with wxPython and I don’t manage to add ctrl-q to quit my simple App.
Following https://wxpython.org/Phoenix/docs/html/wx.AcceleratorTable.html I came up with:
#!/usr/bin/env python
import wx
class Test(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title='Test')
class App(wx.App):
"""App doing a calculation."""
def OnInit(self):
self.frame = Test()
self.frame.Show()
entries = [wx.AcceleratorEntry() for i in range(1)]
entries[0].Set(wx.ACCEL_CTRL, ord('Q'), wx.ID_EXIT)
accel = wx.AcceleratorTable(entries)
self.frame.SetAcceleratorTable(accel)
return True
if __name__ == '__main__':
app = App(False)
app.MainLoop()
It compiles and run, but ctrl-q has no effect…
Any hint?