wxPython - if condition = False then skip some lines or exit without closing Main Frame
<p>in my <code>wxApp</code> that is currently under development, I have bind a button to call a new frame. However I want to put condition in my def that is actually calling the new frame and if that fails the def method should simple exit but not close the main Frame. So basically something like <code>Exit Sub</code> in VBA. Below is my code:-</p>

<pre><code>self.btn_CreateItem.Bind(wx.EVT_BUTTON, self.CreateBtnClicked)

def CreateBtnClicked(self, event):
    if self.rgnCombo.GetValue() == '':
        ctypes.windll.user32.MessageBoxA(0, "Can't create item without selecting Region!!!", '', 1)
        exit()
    call_CreateFrame = CreateItemFrame(None, 'Create work item(s)!!!')
</code></pre>

<p>so in place of <code>exit()</code> in the code above (because it is closing the whole main frame) I want something equivalent to VBA's <code>Exit Sub</code>.</p>

<p>Also is there a way to also skip some scripts and continue from a certain line like the <code>GoTo</code> method of VBA.</p>

<p>Replace</p>

<pre><code>exit()
</code></pre>

<p>with</p>

<pre><code>return
</code></pre>

<p><a href="http://stackoverflow.com/questions/18863309/the-equivalent-of-a-goto-in-python">The equivalent of a GOTO in python</a></p>

python if-statement wxpython goto