when to use wx.App and PySimpleApp

python, wxpython

Solution

Nowadays there's almost no difference between these two classes.

When wxPython project started, `wx.PySimpleApp` and `wx.App` had different behaviour (the latter where more low-level and had not default `OnInit` method defined, while `PySimpleApp` was the class that could be just instantiated and put to do the job). Also some range of wxPython versions had `wx.App` class that had default `OnInit` defined but it didn't call `wx.InitAllImageHandlers` by default.

Now `wx.PySimpleApp` is left in API mostly for the reason of compatibility and there's not distinction between two classes.

Problem

i don't know where and when to use wx.App and PySimpleApp like two code: ``` #!/usr/bin/env python import wx import wx.py.images as images class ToolbarFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300, 200)) panel = wx.Panel(self) panel.SetBackgroundColour('White') class App(wx.App): def OnInit(self): frame = ToolbarFrame(parent=None, id=-1) frame.Show() return True if __name__ == '__main__': app = App() app.MainLoop() ``` and this code: ``` #!/usr/bin/env python import wx class ToolbarFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300, 200)) panel = wx.Panel(self) panel.SetBackgroundColour('White') if __name__ == '__main__': app = wx.PySimpleApp() frame = ToolbarFrame(parent=None, id=-1) frame.Show() app.MainLoop() ``` Are there have any difference? another question other widget is at wx.Frame() or wx.App() like button.

Original source