In my program there is a main part with a windows options and I need to go to Greetings def.
if __name__ == "__main__":
web = Tk()
web.configure(background = "black")
web.title("#######")
web.geometry("600x400")
web.iconbitmap('icon.ico')
web.resizable(False, False)
web.protocol("WM_DELETE_WINDOW", close)
Greetings(log)
def Greetings(log):
log.withdraw()
def clear_form():
greetings_entry_name.delete(0, END)
greetings_entry_password.delete(0, END)
greetings_frame = Frame(web, background = "black", pady = 10)
greetings_frame.pack()
But I have another def with another window (login) and I need the 'log' for giving permission to hide login window.
def login():
web.withdraw()
log = Tk()
...
...
registration_back_button = Button(login_frame, text = "Go back", bg = "#293133", fg = "white", command = Greetings(log))
registration_back_button.pack(pady = 15)
return log
So if i want to compilate i have predictable error
name 'log' is not defined
How can I give log to Greetings or maybe don't do it this way.
log
a global variable so that all functions can access it?log
from yourlogin
function. Why not just keep the returned value in a variable and pass that toGreetings
when you call it?