Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- LARGE_FONT= ("Verdana", 12)
- class SeaofBTCapp(tk.Tk):
- def __init__(self, *args, **kwargs):
- tk.Tk.__init__(self, *args, **kwargs)
- container = tk.Frame(self)
- container.pack(side="top", fill="both", expand = True)
- container.grid_rowconfigure(0, weight=1)
- container.grid_columnconfigure(0, weight=1)
- self.frames = {}
- for F in (HomePage, LoginPage, RegistrationPage, Deliverable1, Display):
- frame = F(container, self)
- self.frames[F] = frame
- frame.grid(row=0, column=0, sticky="nsew")
- self.show_frame(HomePage)
- def show_frame(self, cont):
- frame = self.frames[cont]
- frame.tkraise()
- class HomePage(tk.Frame):
- def __init__(self, parent, controller): #homepage
- tk.Frame.__init__(self,parent)
- self.configure(background="light grey")
- label = tk.Label(self, text="Buisness Solution", font=LARGE_FONT, bg="light grey").pack()
- label1 = tk.Label(self, text="online office supply retailer that ships furniture, tech, pens,\n files, etc. to consumers and corperations nation wide.", font=LARGE_FONT, bg="light grey",bd=1,relief="solid")
- label1.pack(pady=10,padx=10)
- button = tk.Button(self, text="Login", bg="#70ad47", fg="white",
- command=lambda: controller.show_frame(LoginPage))
- button.pack()
- button2 = tk.Button(self, text="New User?", bg="#70ad47", fg="white",
- command=lambda: controller.show_frame(RegistrationPage))
- button2.pack(pady=10)
- class LoginPage(tk.Frame):
- def __init__(self, parent, controller): #LoginPage
- tk.Frame.__init__(self, parent)
- self.configure(background="light grey")
- label = tk.Label(self, text="Enter ID and Password", font=LARGE_FONT, bg="light grey").grid(row=0,column=0)
- label1 = tk.Label(self, text="ID:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=1,column=0)
- label2 = tk.Label(self, text="Password:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=2,column=0)
- entry1 = tk.Entry(self).grid(row=1,column=1)
- entry2 = tk.Entry(self).grid(row=2,column=1)
- button1 = tk.Button(self, text="Back", bg="dark gray", fg="white",
- command=lambda: controller.show_frame(HomePage))
- button1.grid(sticky="W",row=3,column=1,pady=4)
- button2 = tk.Button(self, text="Continue", bg="#70ad47", fg="white", #continue should go to diliverables
- command=lambda: controller.show_frame(Deliverable1))
- button2.grid(sticky="E",row=3,column=1)
- class RegistrationPage(tk.Frame): #registrationpage
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- self.configure(background="light grey")
- label = tk.Label(self, text="Complete the fields below", font=LARGE_FONT, bg="light grey").grid(row=0,column=0)
- label1 = tk.Label(self, text="Username:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=1,column=0)
- label2 = tk.Label(self, text="Employee ID:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=2,column=0)
- label3 = tk.Label(self, text="E-mail:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=3,column=0)
- label5 = tk.Label(self, text="Password:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=4,column=0)
- label6 = tk.Label(self, text="Confirm PW:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=5,column=0)
- entry1 = tk.Entry(self).grid(row=1,column=1)
- entry2 = tk.Entry(self).grid(row=2,column=1)
- entry3 = tk.Entry(self).grid(row=3,column=1)
- entry4 = tk.Entry(self).grid(row=4,column=1)
- entry5 = tk.Entry(self).grid(row=5,column=1)
- button1 = tk.Button(self, text="Back", bg="dark gray", fg="white",
- command=lambda: controller.show_frame(HomePage))
- button1.grid(sticky="w",row=6,column=1,pady=4)
- button2 = tk.Button(self, text="Continue", bg="#70ad47", fg="white",
- command=lambda: controller.show_frame(LoginPage))
- button2.grid(sticky="E",row=6,column=1)
- class Deliverable1(tk.Frame): #registrationpage
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- self.configure(background="light grey")
- label = tk.Label(self, text="Select what to display", font=LARGE_FONT, bg="light grey").grid(row=0,column=0)
- label1 = tk.Label(self, text="10 Most Profitable:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=1,column=0)
- label2 = tk.Label(self, text="10 least profitable:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=2,column=0)
- label3 = tk.Label(self, text="Which State:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=3,column=0)
- label5 = tk.Label(self, text="Which Product:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=4,column=0)
- label6 = tk.Label(self, text="Year:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=5,column=0)
- label7 = tk.Label(self, text="Month:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=6,column=0)
- label8 = tk.Label(self, text="Quarter:", font=LARGE_FONT, bg="light grey").grid(sticky="E",row=7,column=0)
- entry1 = tk.Entry(self).grid(sticky="W",row=6,column=1)
- entry2 = tk.Entry(self).grid(sticky="W",row=7,column=1)
- v = tk.IntVar()
- tk.Radiobutton(self, variable=v, value=1, bg="light grey").grid(sticky="W",row=2,column=1)
- tk.Radiobutton(self, variable=v, value=2, bg="light grey").grid(sticky="W",row=1,column=1)
- button1 = tk.Button(self, text="Log Out", bg="red", fg="white", #make the back button a logout button?
- command=lambda: controller.show_frame(HomePage))
- button1.grid(sticky="w",row=8,column=1,pady=5)
- button2 = tk.Button(self, text="Continue", bg="#70ad47", fg="white", #go to displayproducts in order
- command=lambda: controller.show_frame(Display))
- button2.grid(sticky="E",row=8,column=1)
- stateMainframe = tk.Frame(self) #Which State
- stateMainframe.grid(row=3,column=1, sticky="W" )
- stateMainframe.columnconfigure(0, weight = 1)
- stateMainframe.rowconfigure(0, weight = 1)
- svar = tk.StringVar(self)
- states = { "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut"}
- svar.set("Chose your location")
- stateMenu = tk.OptionMenu(stateMainframe, svar, *states).grid(row = 3, column =1)
- def state_dropdown(*args):
- print( svar.get() )
- svar.trace('w', state_dropdown) #Which State
- productMainframe = tk.Frame(self) #Which Product
- productMainframe.grid(row=4,column=1, sticky="W" )
- productMainframe.columnconfigure(0, weight = 1)
- productMainframe.rowconfigure(0, weight = 1)
- pvar = tk.StringVar(self)
- products = { "Chairs", "Pens", "Televisions", "Desks", "Staplers", "Couches", "Laptops"}
- pvar.set("Chose your product")
- productMenu = tk.OptionMenu(productMainframe, pvar, *products).grid(row = 4, column =1)
- def product_dropdown(*args):
- print( pvar.get() )
- pvar.trace('w', product_dropdown) #Which Product
- yearMainframe = tk.Frame(self) #Which year
- yearMainframe.grid(row=5,column=1, sticky="W" )
- yearMainframe.columnconfigure(0, weight = 1)
- yearMainframe.rowconfigure(0, weight = 1)
- yvar = tk.IntVar(self)
- years = { "2012", "2013", "2014", "2015", "2016", "2017", "2018"}
- yvar.set("Chose the year") # set the default option
- yearMenu = tk.OptionMenu(yearMainframe, yvar, *years).grid(row = 5, column =1)
- def year_dropdown(*args):
- print( yvar.get() )
- yvar.trace('w', year_dropdown) #Which year
- class Display(tk.Frame):
- def __init__(self, parent, controller): #homepage
- tk.Frame.__init__(self,parent)
- self.configure(background="light grey")
- label = tk.Label(self, text="Profitable products", font=LARGE_FONT, bg="light grey").pack(pady=10)
- listbox = tk.Listbox(self).pack()
- #for i in range(20):
- #listbox.insert(END, str(i))
- button = tk.Button(self, text="Back", bg="dark grey", fg="white",
- command=lambda: controller.show_frame(Deliverable1))
- button.pack(pady=7)
- app = SeaofBTCapp()
- app.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement