Close an app on OnPreInit()

hi to everybody,
I was studying the way to close an application from the method OnPreInit and I have written
a script to analyze the sequence of the calls to the throwing of the application.
The script, performed by the shell return this

bc@hal9000:~/Desktop$ python symple_app.py
class App(wx.App):
class MyFrame(wx.Frame):
no man’s land
if name == ‘main’:
OnPreInit(self):
wx.GetApp():<main.App; proxy of <Swig Object of type ‘wxPyApp *’ at 0x1a18110> >
OnPreInit return false
OnInit(self):
def init
super(MyFrame, self).init
p = wx.Panel(self)
self.frame = MyFrame(None, title=‘SympleApp’)
self.SetTopWindow(self.frame)
app = App(redirect = True)

the sequence of the calls allows me a bit perplexed ,
anyway,as I do to make to close the application, that has not not even started…
on OnPreInit method , that justly returns false but the thing doesn’t have some effect
I’ve attached a demo

regards
beppe

symple_app.py (1.34 KB)

Werner

preinit.py (1.53 KB)

···

Hi,

  On 8/20/2014 17:42, beppe wrote:

  I think for what you want you need to return False from OnInit,

see attached.

  Attached works for me with classic, but Phoenix throws this

exception:

  File "d:\devOther\samplesTest\beppe\preinit.py"      ,

line 59, in

    app = App(0)

  File "c:\Python34\Lib\site-packages\wx\core.py"      ,

line 1850, in init

    self._BootstrapApp()

          builtins.TypeError:

invalid result type from App.OnPreInit()

in fact it is what I normally do but I thought about using the return of OnPreinit method

···

Il giorno mercoledì 20 agosto 2014 18:59:06 UTC+2, werner ha scritto:

Hi,

  On 8/20/2014 17:42, beppe wrote:



  I think for what you want you need to return False from OnInit,

see attached.

  Attached works for me with classic, but Phoenix throws this

exception:

  File "d:\devOther\samplesTest\beppe\preinit.py"      ,

line 59, in

    app = App(0)

  File "c:\Python34\Lib\site-packages\wx\core.py"      ,

line 1850, in init

    self._BootstrapApp()



          builtins.TypeError:

invalid result type from App.OnPreInit()

Werner