tkinter python: Want to close initial window and open new one - python

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

Related

How do I make my button know what`s in the entry box and then print that value in a new window?

I want after you write something in the entry box and then you press the button a new window to pop up and
the number that was written in the entry box to be printed in the new window as " Your height is: "value" but after many tries I still don`t understand how to do it.
my code:
import tkinter as tk
root = tk.Tk()
root.geometry("250x130")
root.resizable(False, False)
lbl = tk.Label(root, text="Input your height", font="Segoe, 11").place(x=8, y=52)
entry = tk.Entry(root,width=15).place(x=130, y=55)
btn1 = tk.Button(root, text="Enter", width=12, height=1).place(x=130, y=85) #command=entrytxt1
root.mainloop()
This is what I got:
import tkinter as tk
root = tk.Tk()
root.resizable(False, False)
def callback():
# Create a new window
new_window = tk.Toplevel()
new_window.resizable(False, False)
# `entry.get()` gets the user input
new_window_lbl = tk.Label(new_window, text="You chose: "+entry.get())
new_window_lbl.pack()
# `new_window.destroy` destroys the new window
new_window_btn = tk.Button(new_window, text="Close", command=new_window.destroy)
new_window_btn.pack()
lbl = tk.Label(root, text="Input your height", font="Segoe, 11")
lbl.grid(row=1, column=1)
entry = tk.Entry(root, width=15)
entry.grid(row=1, column=2)
btn1 = tk.Button(root, text="Enter", command=callback)
btn1.grid(row=1, column=3)
root.mainloop()
Basically when the button is clicked it calls the function named callback. It creates a new window, gets the user's input (entry.get()) and puts it in a label.

Trying to create a user name and password to log onto next tkinter window. If user and pass correct login button goes to next screen

Here are the labels and buttons I am using, I want the login button to check for passwords in code, then if correct go to the next screen.
from tkinter import *
root = Tk()
# Main window of Application
root.title("Please Login")
root.geometry("300x150")
root.config(background='lightblue', borderwidth=5)
# Creating Label Widget
myLabel1 = Label(root, text="Username :", background='lightblue')
myLabel2 = Label(root, text="Password :", background='lightblue')
# Entry fields
username_1 = Entry(root)
password_1 = Entry(root, show='*')
# Putting labels onto screen
myLabel1.grid(row=0, column=0)
myLabel2.grid(row=1, column=0)
# Entry field Locations
username_1.grid(row=0, column=1)
password_1.grid(row=1, column=1)
Here i have the command quit button but having a hard time with the command for login to go to next window.
# Creating Buttons
loginButton1 = Button(root, text="Login")
cancelButton3 = Button(root, text="Cancel", command=quit)
# Putting buttons onto screen
loginButton1.grid(row=6, column=1)
cancelButton3.grid(row=7, column=1)
# New window
root.mainloop()
That is a lot for one question... I'll try to give you an idea of how you can do this though. I usually do not create a whole new window; I simply change the already existing window.
from tkinter import *
root = Tk()
# Main window of Application
root.title("Please Login")
root.geometry("300x150")
root.config(background='lightblue', borderwidth=5)
# Possible Login
possible_users = {'user1': 'user1_pass', 'user2': 'user2_pass'} # dictionary of corresponding user name and passwords
# StringVars
the_user = StringVar() # used to retrieve input from entry
the_pass = StringVar()
# Creating Label Widget
myLabel1 = Label(root, text="Username :", background='lightblue')
myLabel2 = Label(root, text="Password :", background='lightblue')
bad_pass = Label(root, text="Incorrect Username or Password")
# Entry fields
username_1 = Entry(root, textvariable=the_user)
password_1 = Entry(root, show='*', textvariable=the_pass)
# Putting labels onto screen
myLabel1.grid(row=0, column=0)
myLabel2.grid(row=1, column=0)
# Entry field Locations
username_1.grid(row=0, column=1)
password_1.grid(row=1, column=1)
def login(user):
forget_login_window()
next_window(user)
def check_login():
requested_user = the_user.get()
try:
if possible_users[requested_user] == the_pass.get():
login(requested_user)
else:
bad_pass.grid(row=2, column=1)
except KeyError:
bad_pass.grid(row=2, column=1)
loginButton1 = Button(root, text="Login", command=check_login)
cancelButton3 = Button(root, text="Cancel", command=quit)
# Putting buttons onto screen
loginButton1.grid(row=6, column=1)
cancelButton3.grid(row=7, column=1)
# New window
def forget_login_window(): # forget all the grid items.
username_1.grid_forget()
password_1.grid_forget()
myLabel1.grid_forget()
myLabel2.grid_forget()
loginButton1.grid_forget()
cancelButton3.grid_forget()
bad_pass.grid_forget()
def next_window(my_user):
root.title(my_user) # desired changes here
# you will need to create your tkinter objects (buttons, labels etc) in global and pack / grid / place them here.
root.mainloop()

Unable to return a value from Tkinter Entry box - need to pass an entry value from one script to another

I'm just about ready to pull my hair out - have tried just about everything I can imagine to do something that on the face of it seems fairly simple...
I need to have an Entry box, which takes in a variable, which is returned to the code and can be used as a variable throughout the script. I actually need to import this script and use it in the code of another script.
At the moment, I know the Submit button is calling the get_data() function, because using 'print' displays the password entered. But using return, to return it to the parent function, and then returning that value and printing the output of the main function returns nothing.
Thanks
from tkinter import *
def get_params():
def get_data():
pw = pwentry_enter.get()
return pw
window = Tk()
headFrame = Frame(window)
headFrame.grid(row=0, pady=6)
header = Label(headFrame, text="Input Password", font=(f1, 20))
header.grid(column=0, row=0, columnspan=2, sticky="w")
mainFrame = Frame(window, bg="#1B2230")
mainFrame.grid(row=1, pady=6)
raw_password = StringVar()
pwentry_enter=Entry(mainFrame, width=30, font=(f2,10), show="*", textvariable=raw_password)
pwentry_enter.pack()
btnFrame = Frame(window)
btnFrame.grid(row=2, pady=6)
submit_btn = Button(btnFrame, text='Submit', command=get_data, width=10, bg="#DB4158", fg="black", font=(f2, 20))
submit_btn.grid(column=1, row=0)
quit_btn = Button(btnFrame, text='Quit', command=window.destroy, width=10, bg="#DB4158", fg="black", font=(f2, 20))
quit_btn.grid(column=0, row=0)
window.mainloop()
a = get_data()
return a
Don't add return in get_data() and use a global variable to store the password when submit button is clicked and return when quit button is pressed.
You are trying to read data of the Entry after destroying the window.
from tkinter import *
pw = ''
def get_params():
global pw
def get_data():
global pw
pw = pwentry_enter.get()
window = Tk()
headFrame = Frame(window)
headFrame.grid(row=0, pady=6)
header = Label(headFrame, text="Input Password", font=(f1, 20))
header.grid(column=0, row=0, columnspan=2, sticky="w")
mainFrame = Frame(window, bg="#1B2230")
mainFrame.grid(row=1, pady=6)
raw_password = StringVar()
pwentry_enter=Entry(mainFrame, width=30, font=(f2,10), show="*", textvariable=raw_password)
pwentry_enter.pack()
btnFrame = Frame(window)
btnFrame.grid(row=2, pady=6)
submit_btn = Button(btnFrame, text='Submit', command=get_data, width=10, bg="#DB4158", fg="black", font=(f2, 20))
submit_btn.grid(column=1, row=0)
quit_btn = Button(btnFrame, text='Quit', command=window.destroy, width=10, bg="#DB4158", fg="black", font=(f2, 20))
quit_btn.grid(column=0, row=0)
window.mainloop()
return pw

tkinter (unsure of my error possibly due to .destroy())

from Tkinter import *
import random
menu = Tk()
subpage = Tk()
entry_values = []
population_values = []
startUpPage = Tk()
def main_menu(window):
window.destroy()
global menu
menu = Tk()
frame1 = Frame(menu)
menu.resizable(width=FALSE, height=FALSE)
button0 = Button(menu, text="Set Generation Zero Values", command=sub_menu(menu))
button1 = Button(menu, text="Display Generation Zero Values")
button2 = Button(menu, text="Run Model")
button3 = Button(menu, text="Export Data")
button4 = Button(menu, text="Exit Program", command=menu.destroy)
button0.grid(row=0, column=0, sticky=W)
button1.grid(row=2, column=0, sticky=W)
button2.grid(row=3, column=0, sticky=W)
button3.grid(row=4, column=0, sticky=W)
button4.grid(row=5, column=0, sticky=W)
menu.mainloop()
def sub_menu(window):
global subpage
window.destroy()
subpage = Tk()
subpage.resizable(width=FALSE, height=FALSE)
#defining sub page items
button5 = Button(subpage, text="Save Generation Data",command = main_menu(subpage))
juveniles_label0 = Label(subpage,text="Juveniles")
adults_label1 = Label(subpage,text="Adults")
seniles_label2 = Label(subpage,text="Seniles")
population_label3 = Label(subpage,text="Popultation")
survival_rate_label4 = Label(subpage,text="Survival Rate (Between 0 and 1)")
entry0 = Entry(subpage)
entry1 = Entry(subpage)
entry2 = Entry(subpage)
entry3 = Entry(subpage)
entry4 = Entry(subpage)
entry5 = Entry(subpage)
button4.grid(row=1, column= 6, sticky=E)
juveniles_label0.grid(row=0, column=1)
adults_label1.grid(row=0, column=2)
seniles_label2.grid(row=0, column=3)
population_label3.grid(row=1, column=0)
survival_rate_label4.grid(row=2, column=0)
entry0.grid(row=1, column=1)
entry1.grid(row=1, column=2)
entry2.grid(row=1, column=3)
entry3.grid(row=2, column=1)
entry4.grid(row=2, column=2)
entry5.grid(row=2, column=3)
#add entry 6 7 8
subpage.mainloop()
main_menu(subpage)
main_menu(startUpPage)
I'm very new to coding and stackoverflow. I am trying to create a GUI that has a main page which will be opened first and a sub page which will be opened by clicking a button which will be stored in the main page. my issue is that I have no clue why it isn't opening my main page. my thought is that it is something to do with the .destroy() or something similar. any help would be much appreciated.
As a general rule, you should create exactly one instance of Tk for the life of your program. That is how Tkinter is designed to be used. You can break this rule when you understand the reasoning behind it, though there are very few good reasons to break the rule.
The simplest solution is to implement your main menu and your sub menu as frames, which you've already done. To switch between them you can simply destroy one and (re)create the other, or create them all ahead of time and then remove one and show the other.
For example, the following example shows how you would create them ahead of time and simply swap them out. The key is that each function needs to return the frame, which is saved in a dictionary. The dictionary is used to map symbolic names (eg: "main", "sub", etc) to the actual frames.
def main_menu(root):
menu = Frame(root)
button0 = Button(menu, text="Set Generation Zero Values",
command=lambda: switch_page("sub"))
...
return menu
def sub_menu(root):
subpage = Frame(root)
button5 = Button(subpage, text="Save Generation Data",
command = lambda: switch_page("main"))
...
return subpage
def switch_page(page_name):
slaves = root.pack_slaves()
if slaves:
# this assumes there is only one slave in the master
slaves[0].pack_forget()
pages[page_name].pack(fill="both", expand=True)
root = Tk()
pages = {
"main": main_menu(root),
"sub": sub_menu(root),
...
}
switch_page("main")
root.mainloop()
For a more complex object-oriented approach see Switch between two frames in tkinter
heres some code that does what you want.. make a window, destroy it when button is clicked and then make a new window...
from Tkinter import *
import random
def main_menu():
global root
root = Tk()
b = Button(root,text='our text button',command = next_page)
b.pack()
def next_page():
global root,parent
parent = Tk()
root.destroy()
new_b = Button(parent,text = 'new Button',command=print_something)
new_b.pack()
def print_something():
print('clicked')
main_menu()
root.mainloop()
parent.mainloop()
ps. ive done this in python3 so keep that in mind though it wouldnt be a problem in my opinion

Login to GUI application

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()

Categories