54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
from tkinter import *
|
|
from tkinter import ttk
|
|
import atexit
|
|
|
|
# Start of Code - Start of Tkinter loop
|
|
Root_Window = Tk()
|
|
Root_Window.title("Prototype GUI") # Sets the GUI Title
|
|
Root_Window.geometry("500x500")
|
|
|
|
style = ttk.Style()
|
|
style.configure("My.TLabel", foreground="white", background="#404040")
|
|
Root_Window.configure(background="#404040")
|
|
|
|
# Attempts to create a Input Frame
|
|
try:
|
|
Input_Box_Frame = ttk.Frame(Root_Window)
|
|
except Exception as e:
|
|
print(e, type(e))
|
|
print("An exception occurred - when creating input Frame.")
|
|
# Attempts to create a Controls Frame
|
|
try:
|
|
Controls_Box_Frame = ttk.Frame(Root_Window, style="My.TLabel")
|
|
except Exception as e:
|
|
print(e, type(e))
|
|
print("An exception occurred - when creating Controls Frame.")
|
|
|
|
try:
|
|
Input_Box_Frame.pack(fill = "both", expand = True)
|
|
Controls_Box_Frame.pack(anchor = "center", expand = True)
|
|
except Exception as e:
|
|
print(e, type(e))
|
|
print("An exception occurred - when placing Frames.")
|
|
|
|
My_Test_Label = Label(Input_Box_Frame, text="First Label", background = "#8B0000", justify = "center")
|
|
My_Test_Label2 = Label(Controls_Box_Frame, text="Second Label", background = "#00008B", justify = "center")
|
|
My_Test_Label3 = Label(Controls_Box_Frame, text="Third Label", background = "#006400", justify = "center")
|
|
My_Test_Label4 = Label(Controls_Box_Frame, text="Fourth Label", background = "yellow", justify = "center")
|
|
My_Test_Label5 = Label(Controls_Box_Frame, text="Am i Centered?", background = "#FF8C00", justify = "center")
|
|
|
|
|
|
My_Test_Label.pack(fill = "both", expand = True)
|
|
My_Test_Label2.grid(row=1, column=0)
|
|
My_Test_Label3.grid(row=1, column=1)
|
|
My_Test_Label4.grid(row=1, column=2)
|
|
My_Test_Label5.grid(row=0, column=0, columnspan=3)
|
|
|
|
Root_Window.mainloop()
|
|
|
|
# Function called on Exit
|
|
def Registered_Exit():
|
|
print("Goodbye!?")
|
|
|
|
# Regestering Exit
|
|
atexit.register(Registered_Exit) |