Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter import messagebox
- import os
- import sys
- #Create a window named root
- root = Tk()
- root.title("NHL Scoreboard!")
- Team_Name="Unassigned"
- #tn_name fuctions assign the team name when the associated team button is clicked
- def tn_Anaheim_Ducks():
- global Team_Name
- Team_Name="Ducks"
- lbl_Team_Name.config(text="Anaheim Ducks")
- def tn_Boston_Bruins():
- global Team_Name
- Team_Name="Bruins"
- lbl_Team_Name.config(text="Boston Bruins")
- def function_start():
- lbl_Team_Name.config(text="Start")
- def main():
- global root
- global Team_Name
- if Team_Name == "Unassigned":
- messagebox.showinfo("Title", "a Tk MessageBox")
- else:
- main = Tk()
- main.title("Main!")
- root.destroy()
- lbl_Team_Def = Label(main, text="Assigned Team: ")
- lbl_Team_Def.grid(row=1,column=0)
- lbl_Team_Name = Label(main, text=Team_Name,anchor='w')
- lbl_Team_Name.grid(row=1,column=1)
- #Declare the team pictures
- #Declare the buttons with associated team logo/name
- btn_Anaheim_Ducks = Button(root,text="Anaheim Ducks",compound="top",command=tn_Anaheim_Ducks)
- btn_Boston_Bruins = Button(root,text="Boston Bruins",compound="top",command=tn_Boston_Bruins)
- btn_Start = Button(root,text="Start", compound="top",command=main,width=12,height=3)
- #Organize the buttons in a 5x6 grid
- btn_Anaheim_Ducks.grid(row=1,column=1)
- btn_Boston_Bruins.grid(row=1,column=2)
- lbl_Team_Def = Label(root, text="Assigned Team: ")
- lbl_Team_Def.grid(row=7,column=1)
- lbl_Team_Name = Label(root, text=Team_Name,anchor='w')
- lbl_Team_Name.grid(row=7,column=2)
- btn_Start.grid(row=7,column=3)
- #Run the main windows
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement