Need a specific user input for login and command prompt

  Kiến thức lập trình

I’m trying to get back into python and am working on a project to keep me learning more. I’m trying to prgram my application to have a user id and password login

def login_screen():
    root.title('Computer Created Ordering')
    root.geometry('1920x1080')
    title2 = tk.Label(root, text='PLEASE ENTER YOUR USER ID AND PASSWORD', font=('Arial 16 bold'), bg='green', fg='#FF0')
    usr_id = tk.Label(root, text='USER ID:')
    usr_id_inp = tk.Entry(root)
    pw = tk.Label(root, text='PASSWORD:')
    pw_inp = tk.Entry(root)
    access_btn = tk.Button(root, text='ACCESS')
    title2.grid()
    au_prompt.grid(row=2, column=0)
    au_prompt_inp.grid(row=2, column=2)
    access_btn.grid(row=2, column=4)
    root.configure(bg='black')

And also a screen for a command prompt

class cmd_prompt():
    root.title('Computer Created Ordering')
    root.geometry('1920x1080')
    au = ['au01', 'au02', 'au03', 'au04', 'au05']
    title2 = tk.Label(root, text='AUTHORIZATION PROMPT', font=('Arial 16 bold'), bg='green', fg='#FF0')
    au_prompt = tk.Label(root, text='COMMAND ID:')
    au_prompt_inp = tk.Entry(root, au)
    access_btn = tk.Button(root, text='ACCESS')
    title2.grid()
    au_prompt.grid(row=2, column=0)
    au_prompt_inp.grid(row=2, column=2)
    access_btn.grid(row=2, column=4)
    root.configure(bg='black')
    au_prompt_inp == au
    
    if au_prompt_inp.get() == au[0]:
        access_btn = tk.Button(root, text='ACCESS', command=au01.inventory_screen)

I’m bassically throwing stuff at the wall and seeing what works while learning. I tried using the .get() function to try and tell the computer to look for one of the texts in “au” and if it equaled it then to go to one of the screens that matched the command. Depending on the way i program it it the application will either launch but not do what i want it to or it will just give an error. What am I doing wrong? Thanks.

New contributor

Ventrillo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT