Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- def log_in():
- def click_ok():
- username = usr_entry_var.get()
- password = pwd_entry_var.get()
- # This is the portion that creates a connection instance
- # that I desire to later perform actions against in the
- # form of connection.doStuff()
- # I have just set it to some text here for brevity, as this
- # portion is working fine.
- connection = 'someStuffThatAuthenticates'
- login.destroy()
- login = tk.Toplevel()
- usr_lbl = tk.Label(login, text='Username:')
- usr_lbl.grid(column=0, row=0)
- usr_entry_var = tk.StringVar()
- usr_entry = tk.Entry(login, width=40, textvariable=usr_entry_var)
- usr_entry.grid(column=1, row=0)
- pwd_lbl = tk.Label(login, text='Password:')
- pwd_lbl.grid(column=0, row=1)
- pwd_entry_var = tk.StringVar()
- pwd_entry = tk.Entry(login, width=40, textvariable=pwd_entry_var)
- pwd_entry.grid(column=1, row=1)
- ok_btn = tk.Button(login, text='OK', command=click_ok)
- ok_btn.grid(column=0, columnspan=2, row=2)
- def click_run():
- connection = log_in()
- # Here is where I perform actions against the returned connection instance.
- # I am just printing it here for brevity.
- print(str(connection))
- root = tk.Tk()
- run_btn = tk.Button(root, text='RUN', command=click_run)
- run_btn.pack()
- root.mainloop()
Add Comment
Please, Sign In to add comment