0

I want to exit my home() before login()

def _home():
    def button_pressed():
        if admin:
            _admin_login()

        if pilot:
            _pilot_login()

    #creating button for admin user
    admin=tk.Button(home, text="Admin logIN", width=20,height=3, bd=0, highlightthicknes=0, command=button_pressed)
    admin.place(x=150, y=200)

    #configuring admin button
    admin.config(image=photoAdmin, width="200", height="240")

    #creating button for pilot log in
    pilot=tk.Button(home, text="Pilot LogIN", width=20, height=3, bd=0, command=button_pressed)
    pilot.place(x=400, y=200)

    #conguring pilot button
    pilot.config(image=photoPilot, width="200", height="240")
thebjorn
  • 26,297
  • 11
  • 96
  • 138
noddy
  • 1
  • 2
  • You can use a `return` statement to exit a function early as well as return a value from that function if you want. The default value of `return` if nothing is supplied is `None`. – blakev Oct 09 '17 at 17:51
  • where should i've to put exit(0) or return – noddy Oct 10 '17 at 16:11
  • Without seeing the rest of your code, it already should. When you create a new `Button` and assigning a function to `command` you're basically attaching a [`callback`](https://stackoverflow.com/questions/4689984/implementing-a-callback-in-python-passing-a-callable-reference-to-the-current). Your `button_pressed` function will only run when the button is clicked in the GUI. – blakev Oct 10 '17 at 16:37

0 Answers0