Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
5001CEM/timetable.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
146 lines (119 sloc)
7.06 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
#import timetableSQL | |
nineJob = "Machine 1:\n Activity 5" | |
tenJob = "Machine 1:\n Activity 5" | |
elevenJob = "Machine 1:\n Activity 5" | |
twelveJob = "Machine 1:\n Activity 5" | |
twoJob = "Machine 1:\n Activity 5" | |
threeJob = "Machine 1:\n Activity 5" | |
fourJob = "Machine 1:\n Activity 5" | |
job = "PlantManager" | |
def edit_timetable_entry(time): | |
edit_timetable_entry = Toplevel() | |
edit_timetable_entry.title("Timetable") | |
edit_timetable_entry.geometry("480x360") | |
edit_timetable_entry.mainloop() | |
def open_timetable_root(): | |
timetable_root = Tk() | |
timetable_root.title("Timetable") | |
timetable_root.geometry("1280x720") | |
def open_timetable_page(): | |
timetable_page = Toplevel() | |
timetable_page.title("Timetable") | |
timetable_page.geometry("1280x720") | |
#label | |
timetable_title = Label(timetable_page, text="Timetable", font="Verdana 24 bold", fg="Blue") | |
nine_am = Label(timetable_page, text="9am", font=("Verdana 14 bold"), fg="Black") | |
ten_am = Label(timetable_page, text="10am", font=("Verdana 14 bold"), fg="Black") | |
eleven_am = Label(timetable_page, text="11am", font=("Verdana 14 bold"), fg="Black") | |
twelve_pm = Label(timetable_page, text="12pm", font=("Verdana 14 bold"), fg="Black") | |
lunch_break = Label(timetable_page, text="Lunch", font=("Verdana 14 bold"), fg="Black") | |
two_pm = Label(timetable_page, text="2pm", font=("Verdana 14 bold"), fg="Black") | |
three_pm = Label(timetable_page, text="3pm", font=("Verdana 14 bold"), fg="Black") | |
four_pm = Label(timetable_page, text="4pm", font=("Verdana 14 bold"), fg="Black") | |
#Buttons | |
nine_am_box = Button(timetable_page, text = "Machine 1:\n Activity 5", font=("Verdana 10"), height=3, width=10) | |
ten_am_box = Button(timetable_page, text = "Machine 1:\n Activity 3", font=("Verdana 10"), height=3, width=10) | |
eleven_am_box = Button(timetable_page, text = "Machine 4:\n Activity 3", font=("Verdana 10"), height=3, width=10) | |
twelve_pm_box = Button(timetable_page, text = "Machine 4:\n Activity 1", font=("Verdana 10"), height=3, width=10) | |
lunch_break_box = Button(timetable_page, text = "", font=("Verdana 10"), height=3, width=10) | |
two_pm_box = Button(timetable_page, text = "Machine 7:\n Activity 5", font=("Verdana 10"), height=3, width=10) | |
three_pm_box = Button(timetable_page, text = "Machine 7:\n Activity 5", font=("Verdana 10"), height=3, width=10) | |
four_pm_box = Button(timetable_page, text = "Machine 7:\n Activity 2", font=("Verdana 10"), height=3, width=10) | |
#Grid | |
timetable_title.grid(row=0, column=0) | |
nine_am.grid(row=3, column=3) | |
ten_am.grid(row=3, column=4) | |
eleven_am.grid(row=3, column=5) | |
twelve_pm.grid(row=3, column=6) | |
lunch_break.grid(row=3, column=7) | |
two_pm.grid(row=3, column=8) | |
three_pm.grid(row=3, column=9) | |
four_pm.grid(row=3, column=10) | |
nine_am_box.grid(row=4, column=3) | |
ten_am_box.grid(row=4, column=4) | |
eleven_am_box.grid(row=4, column=5) | |
twelve_pm_box.grid(row=4, column=6) | |
lunch_break_box.grid(row=4, column=7) | |
two_pm_box.grid(row=4, column=8) | |
three_pm_box.grid(row=4, column=9) | |
four_pm_box.grid(row=4, column=10) | |
timetable_page.mainloop() | |
def open_edit_timetable_page(): | |
edit_timetable_page = Toplevel() | |
edit_timetable_page.title("Edit Timetable") | |
edit_timetable_page.geometry("1280x720") | |
#label | |
edit_timetable_title = Label(edit_timetable_page, text="Edit Timetable", font="Verdana 24 bold", fg="Blue") | |
edit_nine_am = Label(edit_timetable_page, text="9am", font=("Verdana 14 bold"), fg="Black") | |
edit_ten_am = Label(edit_timetable_page, text="10am", font=("Verdana 14 bold"), fg="Black") | |
edit_eleven_am = Label(edit_timetable_page, text="11am", font=("Verdana 14 bold"), fg="Black") | |
edit_twelve_pm = Label(edit_timetable_page, text="12pm", font=("Verdana 14 bold"), fg="Black") | |
edit_lunch_break = Label(edit_timetable_page, text="Lunch", font=("Verdana 14 bold"), fg="Black") | |
edit_two_pm = Label(edit_timetable_page, text="2pm", font=("Verdana 14 bold"), fg="Black") | |
edit_three_pm = Label(edit_timetable_page, text="3pm", font=("Verdana 14 bold"), fg="Black") | |
edit_four_pm = Label(edit_timetable_page, text="4pm", font=("Verdana 14 bold"), fg="Black") | |
#Buttons | |
edit_nine_am_box = Button(edit_timetable_page, text = nineJob, font=("Verdana 10"), height=3, width=10) | |
edit_ten_am_box = Button(edit_timetable_page, text = tenJob, font=("Verdana 10"), height=3, width=10 ) | |
edit_eleven_am_box = Button(edit_timetable_page, text = elevenJob, font=("Verdana 10"), height=3, width=10 ) | |
edit_twelve_pm_box = Button(edit_timetable_page, text = twelveJob, font=("Verdana 10"), height=3, width=10 ) | |
edit_lunch_break_box = Button(edit_timetable_page, text = "", font=("Verdana 10"), height=3, width=10) | |
edit_two_pm_box = Button(edit_timetable_page, text = twoJob, font=("Verdana 10"), height=3, width=10 ) | |
edit_three_pm_box = Button(edit_timetable_page, text = threeJob, font=("Verdana 10"), height=3, width=10 ) | |
edit_four_pm_box = Button(edit_timetable_page, text = fourJob, font=("Verdana 10"), height=3, width=10 ) | |
#Grid | |
edit_timetable_title.grid(row=0, column=0) | |
edit_nine_am.grid(row=3, column=3) | |
edit_ten_am.grid(row=3, column=4) | |
edit_eleven_am.grid(row=3, column=5) | |
edit_twelve_pm.grid(row=3, column=6) | |
edit_lunch_break.grid(row=3, column=7) | |
edit_two_pm.grid(row=3, column=8) | |
edit_three_pm.grid(row=3, column=9) | |
edit_four_pm.grid(row=3, column=10) | |
edit_nine_am_box.grid(row=4, column=3) | |
edit_ten_am_box.grid(row=4, column=4) | |
edit_eleven_am_box.grid(row=4, column=5) | |
edit_twelve_pm_box.grid(row=4, column=6) | |
edit_lunch_break_box.grid(row=4, column=7) | |
edit_two_pm_box.grid(row=4, column=8) | |
edit_three_pm_box.grid(row=4, column=9) | |
edit_four_pm_box.grid(row=4, column=10) | |
edit_timetable_page.mainloop() | |
#Labels | |
empty_label = Label(timetable_root, text=" ") | |
jawara_label = Label(timetable_root, text="Jawara", font="Verdana 24 bold", fg="Red") | |
title_label = Label(timetable_root, text="Timetable", font=("Verdana 23 bold"), fg="Black") | |
#Buttons | |
button_timetable = Button(timetable_root, text = "Timetable", height=3, width=20, command= open_timetable_page ) | |
if job == "PlantManager" or 'AccessoriesProductionManager': | |
button_edit_timetable = Button(timetable_root, text = "Edit Timetable", height=3, width=20, command= open_edit_timetable_page ) | |
#Grid | |
jawara_label.grid(row = 0, column = 0) | |
title_label.grid(row = 0, column = 2) | |
button_timetable.grid(row=2, column=0) | |
if job == "PlantManager" or 'AccessoriesProductionManager': | |
button_edit_timetable.grid(row=3, column=0) | |
timetable_root.mainloop() | |
open_timetable_root() |