This code is supposed to ask login information from the user. Then when it enters the wrong details, it will do a popup (loginErrorWdw) with a label and a button. The button there will exit the program when pressed.
I'm trying to get the button from loginErrorWdw to appear in that window but it won't. Here's my whole block of code.
from tkinter.ttk import *
from tkinter import messagebox
import tkinter as tk
import sys
import os
class Login(Frame):
def __init__(self,master):
Frame.__init__(self,master)
self.grid()
self.loginWidgets()
def loginWidgets(self):
self.userlbl = Label(self, text="Enter username: ")
self.userlbl.grid()
self.unEntry = Entry(self)
self.unEntry.grid(row=0, column=1, sticky=W)
self.pwlbl = Label(self, text="Enter password: ")
self.pwlbl.grid(row=1, column=0, sticky=W)
self.pwEntry = Entry(self, show="*")
self.pwEntry.grid(row=1, column=1, sticky=W)
self.submitBtn = Button(self, text="LOGIN", command=self.checkLogin)
self.submitBtn.grid(row=2, column=1, sticky=W)
def loginErrorWdw(self):
err = tk.Toplevel(self)
err.title("Error")
l = tk.Label(err, text="Invalid login details! The program will exit.")
l.pack(side="top", expand=False, padx=20, pady=20)
btn=tk.Button(err, text="Ok", command=self.exitBtn)
def exitBtn(self):
os._exit(0)
#change def position
def mainWdw(self):
messagebox.showinfo('Main window','Message pop up')
def checkLogin(self):
user = self.unEntry.get()
pw = self.pwEntry.get()
if user == "admin":
if pw == "lbymf1d":
self.mainWdw()
else:
self.loginErrorWdw()
else:
self.loginErrorWdw()
# un = admin, pw = lbymf1d
#window = var
window = Tk()
window.title("Login UI")
# window size
window.geometry('700x300')
login = Login(window)
# loop for window
window.mainloop()
You forgot about btn.pack()
This is way without errors:
from tkinter.ttk import *
from tkinter import messagebox
import tkinter as tk
import sys
# import os
class Login(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.grid()
self.loginWidgets()
def loginWidgets(self):
self.userlbl = Label(self, text="Enter username: ")
self.userlbl.grid()
self.unEntry = Entry(self)
self.unEntry.grid(row=0, column=1, sticky="W") # sticky must be string
self.pwlbl = Label(self, text="Enter password: ")
self.pwlbl.grid(row=1, column=0, sticky="W")
self.pwEntry = Entry(self, show="*")
self.pwEntry.grid(row=1, column=1, sticky="W")
self.submitBtn = Button(self, text="LOGIN", command=self.checkLogin)
self.submitBtn.grid(row=2, column=1, sticky="W")
def loginErrorWdw(self):
err = tk.Toplevel(self)
err.title("Error")
l = tk.Label(err, text="Invalid login details! The program will exit.")
l.pack(side="top", expand=False, padx=20, pady=20)
btn = tk.Button(err, text="Ok", command=self.exitBtn)
btn.pack() # Draw it
def exitBtn(self):
sys.exit(0) # Exit
# change def position
def mainWdw(self):
messagebox.showinfo('Main window', 'Message pop up')
def checkLogin(self):
user = self.unEntry.get()
pw = self.pwEntry.get()
if user == "admin":
if pw == "lbymf1d":
self.mainWdw()
else:
self.loginErrorWdw()
else:
self.loginErrorWdw()
# un = admin, pw = lbymf1d
# window = var
window = tk.Tk()
window.title("Login UI")
# window size
window.geometry('700x300')
login = Login(window)
# loop for window
window.mainloop()
Related
This is the code for my personal project, for some reason, I can't get the button to do anything when pressed.
Edit: So I managed to fix the text deleting after each input, so now it will continue to output as many passwords as I want. I removed the 0.0 in output.delete so it doesn't default the text to 0 after each generated password.
from tkinter import *
from datetime import datetime
import pyperclip as pc
def close_window():
window.destroy()
exit()
# Main GUI program
window = Tk()
window.frame()
window.grid_rowconfigure((0, 1), weight=1)
window.grid_columnconfigure((0, 1), weight=1)
window.title("PW Gen")
window.geometry('+10+10')
window.configure(background="black")
Label(window, bg="black", height=0, width=25, font="Raleway").grid(row=1, column=0, sticky=NSEW)
# Enter the last 4 and generate the password
Label(window, text="Enter the last 4 digits of the Reader Name:", bg="black", fg="white", font="Raleway 12 bold").grid(row=1, column=0, sticky=W)
textentry = Entry(window, width=53, bg="white")
textentry.grid(row=2, column=0, sticky=W)
Button(window, text="Generate Password", width=16, font="Raleway 8 bold", command=click).grid(row=3, column=0, sticky=W)
# Output the password
Label(window, text="\nPassword", bg="black", fg="white", font="Raleway 12 bold").grid(row=4, column=0, sticky=W)
output = Text(window, width=40, height=4, wrap=WORD, background="white")
output.grid(row=5, column=0, columnspan=2, sticky=W)
# Button and Text To Quit GUI
Label(window, text="Click to Quit", bg="black", fg="white", font="Raleway 12 bold").grid(row=6, column=0, sticky=W)
Button(window, text="Quit", width=14, font="Raleway 8 bold", command=close_window).grid(row=7, column=0, sticky=W)
window.mainloop()
Not exactly the best solution but you can definitely give it a try.
import tkinter as tk
from datetime import datetime
import string
import pyperclip as pc
import random
root = tk.Tk()
root.title("PW Gen")
root.geometry('+10+10')
mainframe = tk.Frame(root)
text = tk.Text(root, height=5, width=25, font="Raleway")
def pwgen():
last4=text.get('1.0','end')[-5:]
j=[char for char in last4 if char in string.ascii_uppercase or char in string.ascii_lowercase]
print(j)
random.shuffle(j)
print(j)
today = datetime.today()
pw = int(today.strftime("%d")) * int(today.strftime("%m"))
last4=''.join(j)
pwgen = "$ynEL" + str(pw) + str()
pc.copy(pwgen)
print("\nThe password is $ynEL" + str(pw) + str(last4))
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.quit1 = tk.Button(self, text="QUIT", fg="black", command=self.master.destroy)
self.quit1.pack(side="top")
text.pack(side="bottom")
self.b2 = tk.Button(self)
self.create_widgets()
self.pack()
def create_widgets(self):
self.b2["text"] = "GenPW"
self.b2["command"] = pwgen
self.b2.pack(side="left")
def b1(self):
self.b2 = tk.Button(self, text="Generate PW", command=pwgen)
app = Application(root)
root.mainloop()
The code has many problems.
mainframe is not shown and never used.
Text is shown, but never used.
Text is packed inside Application but is not part of Application.
pwgen uses input and no GUI widget. A infinte loop with a GUI application is not good.
You should use the attributes of a datetime directly.
You should not generate the password at two places in the code.
You should not name a local variable like the function.
In Application you are using b1 as method, this method is overloaded by the attribute b1, so you cannot use the method anymore.
In the method b1 you are generating a new butten instead of calling the function pwgen.
import tkinter as tk
from datetime import datetime
import pyperclip as pc
def pwgen():
today = datetime.today()
pw = today.day * today.month
last4 = input("Last 4 of Reader Name [****] ")
password = f"$ynEL{pw}{last4}"
pc.copy(password)
print("\nThe password is", password)
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.quit = tk.Button(self, text="QUIT", fg="black", command=self.master.destroy)
self.quit.pack(side="top")
self.b1 = tk.Button(self, text="GenPW", command=self.click_b1)
self.b1.pack(side="left")
def click_b1(self):
pwgen()
def main():
root = tk.Tk()
root.title("PW Gen")
root.geometry('+10+10')
text = tk.Text(root, height=5, width=25, font="Raleway")
text.pack(side="bottom")
app = Application(master=root)
app.pack()
root.mainloop()
if __name__ == "__main__":
main()
This works. I have used grid manager for more control and removed unused code.
import tkinter as tk
from tkinter import *
from datetime import datetime
import pyperclip as pc
root = tk.Tk()
root.title("PW Gen")
root.geometry('+10+10')
Text = tk.Text(root, height=5, width=25, font="Raleway")
def pwgen():
while True:
today = datetime.today()
pw = int(today.strftime("%d")) * int(today.strftime("%m"))
last4 = input("Last 4 of Reader Name [****] ")
pwgen = "$ynEL" + str(pw) + str(last4)
pc.copy(pwgen)
print("\nThe password is $ynEL" + str(pw) + str(last4))
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.quit = tk.Button(self, text="QUIT", fg="black", command=self.master.destroy)
self.quit.grid(row=0,column=0,sticky=tk.EW)
Text.grid(row=1,column=0,sticky=tk.NSEW)
self.b1 = tk.Button(self, text="Generate PW", command=pwgen)
self.b1.grid(row=0,column=1,sticky=tk.EW)
self.grid(row=0,column=0,sticky=tk.NSEW)
app = Application(master=root)
root.mainloop()
A previous version created multiple Generate PW buttons.
I am currently working on a password manager, where the initial window will ask for login or to create a password. after clicking on login button I wanted to close that initial window and open the main password manager window. Here's my code:-
# ---------------------------- Creating password/ Login ------------------------------- #
def login():
password = my_entry.get()
if saved_pass == password:
# what to write here
pass
else:
# when you type wrong password.
error_label.config(text="Password didn't Match. Try Again.", fg='red')
# error_label.place(x=160, y=330)
def create():
password = my_entry.get()
if len(password) > 8 and ' ' not in password:
error_label.config(text="Your Current Password is Saved.", fg='green')
with open('login_password.json', 'w') as add_pass:
json.dump(password, add_pass)
else:
my_entry.delete(0, END)
error_label.config(text="Password is Too Short or Not Valid.", fg='red')
# ----------------------------Initial UI SETUP ------------------------------- #
initial_window = Tk()
initial_window.title('new page')
initial_window.geometry("460x430")
initial_window.config(padx=20, pady=20, bg=INITIAL_BG)
img = PhotoImage(file='new.png')
canvas = Canvas(width=360, height=250, highlightthickness=0, bg=INITIAL_BG)
canvas.create_image(210, 135, image=img)
canvas.grid(row=1, column=0, columnspan=2, sticky='ew')
my_label = Label(text='Create Password:', bg=INITIAL_BG)
my_label.grid(row=2, column=0, sticky='ew')
my_entry = Entry()
my_entry.grid(row=2, column=1, sticky='ew')
my_entry.focus()
error_label = Label(text=" * Password should have at least 8 characters", fg='black', bg=INITIAL_BG)
error_label.place(x=160, y=330)
save_button = Button(text='Save', width=20)
save_button.place(x=185, y=290)
try:
with open('login_password.json') as data:
saved_pass = json.load(data)
save_button.config(text='Login')
my_label.config(text='Enter Password')
save_button.config(command=login)
error_label.config(text='')
except (json.decoder.JSONDecodeError, FileNotFoundError):
SAVED = False
save_button.config(command=create)
# ----------------------------After UI SETUP ------------------------------- #
window = Tk()
window.title('Password Manager')
window.config(padx=50, pady=50, bg=AFTER_BG)
window.mainloop()
Instead of deleting the original window, just re-use it.
Create a function or class to create the login window, and another one to create the main program. Call the function to create the login window. When the user logs in, destroy all of the widgets for the login window and create the widgets for the main program.
This is easiest if the login window widgets all exist inside a frame. You can then destroy the frame, and all of the other widgets will automatically get destroyed. Or, you can simply loop over all of the children in the main window to destroy them:
for child in window.winfo_children():
child.destroy()
Once you do that, the window is now empty and you can recreate it with all of the main application widgets.
Here is one way of doing this:
from tkinter import Tk, Toplevel, Button
class MainWindow(Tk):
def __init__(self):
Tk.__init__(self)
self.title('Main Window')
self.geometry('500x300')
class LoginWindow(Toplevel):
def __init__(self, parent):
Toplevel.__init__(self, parent)
self.parent = parent
self.title('LoginWindow')
self.geometry('500x300')
self.protocol('WM_DELETE_WINDOW', root.quit)
Button(self, text='Login', command=self.login).pack()
def login(self):
self.destroy()
self.parent.deiconify()
if __name__ == '__main__':
root = MainWindow()
root.withdraw()
login = LoginWindow(root)
root.mainloop()
MainWindow is the main window so that is why it inherits from Tk and gets withdrawn at start, it is also possible to reverse this so that the MainWindow inherits from Toplevel and then make the login window inherit from Tk but Toplevel is usually the one whos parent is Tk so it wouldn't make sense in that way. Otherwise that option is also valid. However one minor drawback is that icons in the taskbar will shift a bit when moving from LoginWindow to MainWindow, so to avoid that You can also just use frames and switch between those.
Also (I forgot) there has to be a protocol set in this case in the LoginWindow that tells what happens if window is closed. self.protocol('WM_DELETE_WINDOW', root.quit) because otherwise the MainWindow will still keep running in the background (if X in the upper right corner is pressed), can also use self.parent.destroy
Here is the same solution but using functions:
from tkinter import Tk, Toplevel, Button
def login_window(parent):
def login():
tp.destroy()
parent.deiconify()
tp = Toplevel()
tp.title('Login Window')
tp.geometry('500x300')
tp.protocol('WM_DELETE_WINDOW', parent.quit)
Button(tp, text='Login', command=login).pack()
def main_window():
root = Tk()
root.title('Main Window')
root.geometry('500x300')
root.withdraw()
login_window(root)
root.mainloop()
if __name__ == '__main__':
main_window()
Solution:- To kill current Window use window_name.destroy() and then call a function and initialize second window's elements into it. Thanks to and #Matiiss #Scrapper142 for guidance. You can call fucntion with button and give some arguments in it by using lambda.
EX- button = Button(text='click', command= lambda: function_name(arguments))
----------------------------After UI SETUP -------------------------------
def password_manager():
window = Tk()
window.title('Password Manager')
window.config(padx=50, pady=50, bg=AFTER_BG)
# image
logo_img = PhotoImage(file='logo.png')
canvas = Canvas(width=200, height=200, highlightthickness=0, bg=AFTER_BG)
canvas.create_image(100, 100, image=logo_img)
canvas.grid(row=0, column=1)
# website data
website_text = Label(text='Website:', bg=AFTER_BG, fg='white')
website_text.grid(row=1, column=0)
website_data = Entry(width=32, bg=AFTER_BG, fg='white', highlightcolor='red')
website_data.focus()
website_data.grid(row=1, column=1, sticky='w')
# email data
email_text = Label(text='Email/Username:', bg=AFTER_BG, fg='white')
email_text.grid(row=2, column=0)
email_data = Entry(width=51, bg=AFTER_BG, fg='white')
email_data.insert(END, 'lalitwizz21#gmail.com')
email_data.grid(row=2, column=1, columnspan=2, sticky='e')
# password data
password_text = Label(text='Password:', bg=AFTER_BG, fg='white')
password_text.grid(row=3, column=0)
password_data = Entry(width=32, bg=AFTER_BG, fg='white')
password_data.grid(row=3, column=1, sticky='w')
# button to Generate Password
password_generator_button = Button(text='Generate Password', width=14, command=lambda: password_generator(password_data))
password_generator_button.grid(row=3, column=2, sticky='e')
# button to add records
add_button = Button(text='Add', width=43, command=lambda: save_password(website_data, email_data, password_data), highlightthickness=0)
add_button.grid(row=4, column=1, columnspan=2)
search_button = Button(text='Search', width=14, command=lambda: search_record(website_data), highlightthickness=0)
search_button.grid(row=1, column=2, sticky='e')
window.mainloop()
---------------------------- Creating password/ Login -------------------------------
def login():
password = my_entry.get()
if saved_pass == password:
initial_window.destroy()
password_manager()
else:
# when you type wrong password.
error_label.config(text="Password didn't Match. Try Again.", fg='red')
# error_label.place(x=160, y=330)
def create():
password = my_entry.get()
if len(password) > 8 and ' ' not in password:
error_label.config(text="Your Current Password is Saved.", fg='green')
with open('login_password.json', 'w') as add_pass:
json.dump(password, add_pass)
else:
my_entry.delete(0, END)
error_label.config(text="Password is Too Short or Not Valid.", fg='red')
----------------------------Initial UI SETUP -------------------------------
initial_window = Tk()
initial_window.title('new page')
initial_window.geometry("460x430")
initial_window.config(padx=20, pady=20, bg=INITIAL_BG)
img = PhotoImage(file='new.png')
canvas = Canvas(width=360, height=250, highlightthickness=0, bg=INITIAL_BG)
canvas.create_image(210, 135, image=img)
canvas.grid(row=1, column=0, columnspan=2, sticky='ew')
my_label = Label(text='Create Password:', bg=INITIAL_BG)
my_label.grid(row=2, column=0, sticky='ew')
my_entry = Entry()
my_entry.grid(row=2, column=1, sticky='ew')
my_entry.focus()
error_label = Label(text=" * Password should have at least 8 characters", fg='black', bg=INITIAL_BG)
error_label.place(x=160, y=330)
save_button = Button(text='Save', width=20)
save_button.place(x=185, y=290)
try:
with open('login_password.json') as data:
saved_pass = json.load(data)
save_button.config(text='Login')
my_label.config(text='Enter Password')
save_button.config(command=login)
error_label.config(text='')
except (json.decoder.JSONDecodeError, FileNotFoundError):
SAVED = False
save_button.config(command=create)
initial_window.mainloop()
Try initial_window.destroy(). This closes the window and ends all of its processes. Then setting up a new variable window = Tk() will open a new window
In this code when the user enters the link, a short version of the link get displayed but it does not give the ability to the user to copy the link from the GUI. How do i fix this?
import pyshorteners as pr
from tkinter import *
root = Tk()
e = Entry(root, width=50)
e.pack()
def click():
link = e.get()
shortener = pr.Shortener()
Short_Link = shortener.tinyurl.short(link)
Label1 = Label(root, text=Short_Link)
Label1.pack()
Button1 = Button(root, text="Enter link:", command=click)
Button1.pack()
root.mainloop()
You can't directly copy the text from a Tkinter Label widget with CTRL+C.
This is a simple Tkinter app to copy the text of a Label to the clipboard:
from tkinter import *
from tkinter.messagebox import showinfo
class CopyLabel(Tk):
def __init__(self, text: str):
super(CopyLabel, self).__init__()
self.title('Copy this Label')
self.label_text = text
self.label = Label(self, text=text)
self.label.pack(pady=10, padx=40)
self.copy_button = Button(self, text='COPY TO CLIPBOARD', command=self.copy)
self.copy_button.pack(pady=5, padx=40)
def copy(self):
self.clipboard_clear()
self.clipboard_append(self.label_text)
self.update()
showinfo(parent=self, message='Copied to clipboad!')
if __name__ == "__main__":
app = CopyLabel('Copy me!')
app.mainloop()
In your code to copy automatically the Short_Link you can do:
import pyshorteners as pr
from tkinter import *
root = Tk()
e = Entry(root, width=50)
e.pack()
def click(master: Tk):
link = e.get()
shortener = pr.Shortener()
Short_Link = shortener.tinyurl.short(link)
master.clipboard_clear()
master.clipboard_append(Short_Link)
master.update()
Label1 = Label(root, text=Short_Link)
Label1.pack()
Button1 = Button(root, text="Enter link:", command=lambda: click(root))
Button1.pack()
root.mainloop()
I am writing a code for a login system using tkinter and for some reason when I run the code there are no error messages and a window pops up but without the title, buttons or labels I need.
from tkinter import *
import tkinter.messagebox
frame = Tk()
def adminlogincheck(self, master):
frame = Frame(master)
frame.pack()
if username == '123key' and password == 'key123':
accept = Label(frame, text='Login Successful')
else:
decline = Label(frame, text='Login incorrect')
mainloop()
def adminselect(self, master):
frame = Frame(master)
frame.pack()
self.button = Button(frame, text="Cancel", fg="red", command=quit)
self.button.pack(side=LEFT)
self.slogan = Button(frame, text="Proceed", command=self.adminlogin)
self.slogan.pack(side=LEFT)
mainloop()
def adminlogin(self, master):
frame = Frame(master)
frame.pack()
username_entry = Entry(frame)
password_entry = Entrey(frame)
confirm = Button(frame, text='Login', command = adminlogincheck)
loginquit = Button(frame, text='Cancel', command=quit)
mainloop()
I will add more after the login system works but does anyone know why no buttons or labels appear?
There's enough in your request to see what you're trying to accomplish, but there are many issues with the code. Here is a working model of what you appear to be working toward...
from tkinter import *
import tkinter.messagebox
class Admin:
def __init__(self, master):
self.frame = Frame(master)
self.frame.pack()
self.username = StringVar()
self.password = StringVar()
def logincheck(self):
self.clearframe()
if self.username.get() == '123key' and self.password.get() == 'key123':
accept = Label(self.frame, text='Login Successful')
accept.pack(side=LEFT)
else:
decline = Label(self.frame, text='Login incorrect')
decline.pack(side=LEFT)
def select(self):
self.clearframe()
self.button = Button(self.frame, text="Cancel", fg="red", command=quit)
self.button.pack(side=LEFT)
self.slogan = Button(self.frame, text="Proceed", command=self.adminlogin)
self.slogan.pack(side=LEFT)
def login(self):
self.clearframe()
username_entry = Entry(self.frame, textvariable=self.username)
username_entry.pack()
password_entry = Entry(self.frame, textvariable=self.password)
password_entry.pack()
confirm = Button(self.frame, text='Login', command = self.logincheck)
confirm.pack()
loginquit = Button(self.frame, text='Cancel', command=quit)
loginquit.pack()
def clearframe(self):
# Destroy all children of the class's frame.
for child in self.frame.winfo_children():
child.destroy()
root = Tk()
admin = Admin(root)
admin.login()
mainloop()
I am not familiar with python and creating user login entry window to login to the another window. The problem is that how can I make sure that it is logged in after entering correct username and password. I could go to the window that I want to login by entering the username and password but I think the coding is still not correct. Another thing is that when the login window pop up, if the user just close the window without entering username and password, the program should just quit. However it still continues to go to the window. Below is my code.
Thank you very much in advance
import Tkinter
from Tkinter import Tk, Text, BOTH, W, N, E, S
from ttk import Frame, Button, Label, Style
class MainWindow(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("AUTO TIPS")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
self.columnconfigure(1, weight=1)
self.columnconfigure(3, pad=7)
self.rowconfigure(3, weight=1)
self.rowconfigure(5, pad=7)
lbl = Label(self, text="Status")
lbl.grid(sticky=W, pady=4, padx=5)
area = Text(self)
area.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E+W+S+N)
abtn = Button(self, text="Drive Command", command=win3)
abtn.grid(row=1, column=3)
cbtn = Button(self, text="Tester Manual Control", command=win2)
cbtn.grid(row=2, column=3, pady=4)
dbtn = Button(self, text="Auto Run", command=AutoTIPS)
dbtn.grid(row=3, column=3, pady=4)
obtn = Button(self, text="OK", command=self.parent.destroy)
obtn.grid(row=5, column=3)
####################################################################################################################################################
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
failure_max = 3
passwords = [('Aung', 'Aung')]
def make_entry(parent, caption, width=None, **options):
tk.Label(parent, text=caption).pack(side=tk.TOP)
entry = tk.Entry(parent, **options)
if width:
entry.config(width=width)
entry.pack(side=tk.TOP, padx=10, fill=tk.BOTH)
return entry
def enter(event):
check_password()
def check_password(failures=[]):
# Collect 1's for every failure and quit program in case of failure_max failures
print(user.get(), password.get())
if (user.get(), password.get()) in passwords:
root.destroy()
print('Logged in')
return
failures.append(1)
if sum(failures) >= failure_max:
root.destroy()
raise SystemExit('Unauthorized login attempt')
else:
root.title('Try again. Attempt %i/%i' % (sum(failures)+1, failure_max))
root = tk.Tk()
root.geometry('300x160')
root.title('Enter your information')
#frame for window margin
parent = tk.Frame(root, padx=10, pady=10)
parent.pack(fill=tk.BOTH, expand=True)
#entrys with not shown text
user = make_entry(parent, "User name:", 16, show='')
password = make_entry(parent, "Password:", 16, show="*")
#button to attempt to login
b = tk.Button(parent, borderwidth=4, text="Login", width=10, pady=8, command=check_password)
b.pack(side=tk.BOTTOM)
password.bind('<Return>', enter)
user.focus_set()
parent.mainloop()
####################################################################################################################################################
def win2():
board = Tkinter.Toplevel()
board.title("Tester Manual Control")
s1Var = Tkinter.StringVar()
s2Var = Tkinter.StringVar()
s3Var = Tkinter.StringVar()
s4Var = Tkinter.StringVar()
s5Var = Tkinter.StringVar()
s6Var = Tkinter.StringVar()
s7Var = Tkinter.StringVar()
s8Var = Tkinter.StringVar()
s1Var.set(" Tester 1")
s2Var.set(" Tester 2")
s3Var.set(" Tester 3")
s4Var.set(" Tester 4")
s5Var.set(" Tester 5")
s6Var.set(" Tester 6")
s7Var.set(" Tester 7")
s8Var.set(" Tester 8")
square1Label = Tkinter.Label(board,textvariable=s1Var)
square1Label.grid(row=1, column=500)
square2Label = Tkinter.Label(board,textvariable=s2Var)
square2Label.grid(row=2, column=500)
square3Label = Tkinter.Label(board,textvariable=s3Var)
square3Label.grid(row=3, column=500)
square4Label = Tkinter.Label(board,textvariable=s4Var)
square4Label.grid(row=4, column=500)
square5Label = Tkinter.Label(board,textvariable=s5Var)
square5Label.grid(row=5, column=500)
square6Label = Tkinter.Label(board,textvariable=s6Var)
square6Label.grid(row=6, column=500)
square7Label = Tkinter.Label(board,textvariable=s7Var)
square7Label.grid(row=7, column=500)
square8Label = Tkinter.Label(board,textvariable=s8Var)
square8Label.grid(row=8, column=500)
####################################################################################################################################################
def win3():
board = Tkinter.Toplevel()
board.title("Drive Command")
codeloadButton = Tkinter.Button(board, text="Code Load", command=win4)
codeloadButton.grid(row=100, column=50)
clearButton = Tkinter.Button(board, text="Clear Dos Table", command=win5)
clearButton.grid(row=500, column=50)
####################################################################################################################################################
def win4():
board = Tkinter.Toplevel()
board.title("Code Load")
####################################################################################################################################################
def win5():
board = Tkinter.Toplevel()
board.title("Clear Dos Table")
####################################################################################################################################################
def main():
root = Tk()
root.geometry("350x300+300+300")
app = MainWindow(root)
root.mainloop()
if __name__ == '__main__':
main()