From: Robin D. <ro...@al...> - 2005-04-11 19:01:41
|
John Hunter wrote: > wxapp = None # module level > > def new_figure_manager(num, *args, **kwargs): > global wxapp > if wxapp is None: > wxapp = wx.PySimpleApp() > wxapp.SetExitOnFrameDelete(True) > ...snipsnip... > > > > def show(): > ...snipsnip... > if show._needmain and not matplotlib.is_interactive(): > if wxapp is not None: wxapp.MainLoop() > show._needmain = False > > > And this seems to work for pylab and wx apps. Since apps will never > call new_figure_manager or show, there should be no problem > > > If there is a better / more elegant / more wxlike way to do this, let > me know. You should check wx.GetApp() to ensure that the app hasn't already been created in some other module. -- Robin Dunn Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython! |