Call a __init__ function from another function
<p>I need some help form all of you, so i have something like this</p>

<pre><code>class LoginFrame(Frame):

    def __init__(self, master):
        super().__init__(master)
        ...
        ...
        ...
   def _login_btn_clickked(self):

        ...
        ...
        result = messagebox.askyesno("Wrong username or password.", "Do you want to try again?")
        if result == True:
             self.__init__(self)
</code></pre>

<p>So if the user select the option to try again i need the whole program start again, and show the login box. But when i execute the program the process fail. </p>

<blockquote>
  <p>But when i execute the program the process fail. </p>
</blockquote>

<p>Actually it should. <code>__init__</code> method is normally called once an instance is created. You need to redesign this to either recreate an instance (first call <code>pack_forget</code> on that frame and then make new one and pack on that place), or do it using methods, like <code>show_loginbox</code> etc</p>

<p>Usually, loginboxes are made using <code>Toplevel</code> with <code>Entry</code> as fields and some buttons to post a result. If done so, on error you could simply erase login or/and passwords entry box and show an error
What I mean is:</p>

<p><a href="http://i.stack.imgur.com/XRBRR.png" rel="nofollow"><img src="http://i.stack.imgur.com/XRBRR.png" alt="first"></a>
<a href="http://i.stack.imgur.com/qhwxs.png" rel="nofollow"><img src="http://i.stack.imgur.com/qhwxs.png" alt="next"></a></p>

<p>reference implementation of above is <a href="https://gist.github.com/thodnev/8cd74504a776933bcf110574c7bb7c76" rel="nofollow">here</a></p>

python recursion