So! I take an input into an entry box in tkinter, and when the user clicks submit, I want a function to run. Example of my code is below - error is that 'Login is not defined'. How can I fix this? Where should I be defining my function?
import tkinter as tk
from tkinter import ttk
class Window(tk.Tk):
def __init__(self):
super().__init__()
self.geometry('1000x500+120+250')
#creates entry button
entry_button = ttk.Button(self, text = "Enter", command = Login)
entry_button.pack()
#creates username entry box
userName_entry = ttk.Entry(self, textvariable = userName)
userName_entry.pack()
openingWin = Window()
openingWin.mainloop()
def Login:
userName = userName_entry.get()
userName_entry.config(state = "disabled")
print(userName)