I started coding this little password generator (with gui)using tkinter. When I got to the part where I actually had to add the generating function to the gui I ran into problems. One of the main problems was the fact that when giving the button in the tkinter window the actual function the following error showed up "NameError: name 'convertor' is not defined". I don't know how to fix it , if any of you are willing to help a new programmer I would appreciate that. Here is the code:
from tkinter import *
import random
wb = Tk()
wb.config(bg="#111116")
wb.geometry("300x300")
frame=Frame(height=200,width=200,bg="#111116")
frame.pack()
bt=Button(text="Generate",fg="white",bg="#111116",command=lambda : convertor())
bt.pack()
la=Label(frame,height=4,width=15,text="Your password here:")
la.grid(column=10,row=10)
entry1=Entry(wb,relief=SUNKEN,text="How long should the password be? ")
entry1.pack()
wb.mainloop()
def convertor(inter,pass_len,password,characters):
characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
pass_len = int(entry1.get())
inter=""
password = ""
for x in range(0, pass_len):
inter = random.choice(characters)
password = password + inter
print(password)
convertor()
I thank you in advance to anyone willing to help a beginner out:)