python : How to return from function in sub if statment? -


i have following code:

 def func(self,e):     if x>0:         dlg = wx.messagedialog(parent, "are sure?", 'warning!', wx.ok | wx.cancel| wx.icon_warning)         result=dlg.showmodal()         dlg.destroy()         if result== wx.cancel:             return     win = frmpop(parent,data) 

my question on:

if result== wx.cancel:     return 

this if statement sub statement of if x>0 intended return out of func1 instead doesn't , frmpop being called. looks return statement existing if x>0.
there way change if result== wx.cancel exit func? know can flags.

something like:

flag=0  ...     if result== wx.cancel:         flag=1 if flag==0:     win = frmpop(parent,data) 

but i'm wondering if there more pythonic / stylish way that. tried break , continue have no loop here wont accept them.

wx.cancel not returned showmodal():

shows dialog, returning 1 of id_ok, id_cancel, id_yes, id_no or id_help.

so, need result == wx.id_cancel


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -