Files
PiperTTS-scripts/Uptated-Prototype/tkinter-Test.py

52 lines
1.6 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")
# 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)
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, style="My.TLabel")
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 = "red", justify = "center")
My_Test_Label2 = Label(Controls_Box_Frame, text="Second Label", background = "blue", justify = "center")
My_Test_Label3 = Label(Controls_Box_Frame, text="Third Label", background = "green", justify = "center")
My_Test_Label4 = Label(Controls_Box_Frame, text="Fourth Label", background = "yellow", justify = "center")
My_Test_Label.pack(fill = "both", expand = True)
My_Test_Label2.grid(row=0, column=0)
My_Test_Label3.grid(row=0, column=1)
My_Test_Label4.grid(row=0, column=2)
Root_Window.mainloop()
# Function called on Exit
def Registered_Exit():
print("Goodbye!?")
# Regestering Exit
atexit.register(Registered_Exit)