Update Uptated-Prototype/PiperTTS-GUI-Test.py

This commit is contained in:
2025-12-01 08:29:41 -08:00
parent d42b71a8f8
commit f562802405

View File

@@ -6,8 +6,8 @@ Root_Window = Tk()
Root_Window.title("PiperTTS - Prototype GUI") # Sets the GUI Title Root_Window.title("PiperTTS - Prototype GUI") # Sets the GUI Title
# Setting up Window Starting Size and Position # Setting up Window Starting Size and Position
Window_Width = 425 Window_Width = 426
Window_Height = 575 Window_Height = 576
# Getting Screen Width and Height # Getting Screen Width and Height
Screen_Width = Root_Window.winfo_screenwidth() Screen_Width = Root_Window.winfo_screenwidth()
Screen_Height = Root_Window.winfo_screenheight() Screen_Height = Root_Window.winfo_screenheight()
@@ -19,15 +19,29 @@ Root_Window.geometry(f'{Window_Width}x{Window_Height}+{int(Window_PosX)}+{int(Wi
# Attempts to make a Input box # Attempts to make a Input box
try: try:
Input_Box_Frame = Frame(Root_Window, width=400, height=400) Input_Box_Frame = Frame(Root_Window)
Input_Box_Frame.grid(row=0, column=0, columnspan=5, padx=10, pady=20, sticky="NSEW") except:
print("An exception occurred - when creating input Frame.")
Main_Text_Scrollbar = Scrollbar(Input_Box_Frame) try:
Main_Text_Scrollbar.pack(side=RIGHT, fill=y) Controls_Box_Frame = Frame(Root_Window)
except:
print("An exception occurred - when creating Controls Frame.")
try:
Input_Box_Frame.place(x = 0, y = 0, relwidth = 1, relheight = 0.8)
Controls_Box_Frame.place(x = 0, rely = 0.8, relwidth = 1, relheight = 0.8)
except:
print("An exception occurred - when placing Frames.")
#Input_Box_Frame.grid(row=0, column=0, columnspan=5, padx=10, pady=20, sticky="NSEW")
#Main_Text_Scrollbar = Scrollbar(Input_Box_Frame)
#Main_Text_Scrollbar.pack(side=RIGHT, fill=y)
try:
Input_Box = Text(Input_Box_Frame, Yscrollcommand=Main_Text_Scrollbar.set) Input_Box = Text(Input_Box_Frame, Yscrollcommand=Main_Text_Scrollbar.set)
Input_Box.pack(padx=20, pady=20) Input_Box.pack(padx=20, pady=20)
except: except:
print("An exception occurred - when creating input box.") print("An exception occurred - when creating input box.")
@@ -35,7 +49,7 @@ except:
def PiperTTS_GUI_Play(): def PiperTTS_GUI_Play():
try: try:
PiperTTS_GUI_Hide_All_Labels() PiperTTS_GUI_Hide_All_Labels()
My_Label = Label(Root_Window, text="Playing?").grid(row=3, column=0, columnspan=5) My_Label = Label(Controls_Box_Frame, text="Playing?").grid(row=3, column=0, columnspan=5)
global labels = [] global labels = []
labels.append(My_Label) labels.append(My_Label)
C_Button_Pause["state"] == "normal" C_Button_Pause["state"] == "normal"
@@ -47,7 +61,7 @@ def PiperTTS_GUI_Play():
def PiperTTS_GUI_Pause(): def PiperTTS_GUI_Pause():
try: try:
PiperTTS_GUI_Hide_All_Labels() PiperTTS_GUI_Hide_All_Labels()
My_Label = Label(Root_Window, text="Pause?").grid(row=3, column=0, columnspan=5) My_Label = Label(Controls_Box_Frame, text="Pause?").grid(row=3, column=0, columnspan=5)
global labels = [] global labels = []
labels.append(My_Label) labels.append(My_Label)
C_Button_Pause["state"] == "disabled" C_Button_Pause["state"] == "disabled"
@@ -59,7 +73,7 @@ def PiperTTS_GUI_Pause():
def PiperTTS_GUI_Stop(): def PiperTTS_GUI_Stop():
try: try:
PiperTTS_GUI_Hide_All_Labels() PiperTTS_GUI_Hide_All_Labels()
My_Label = Label(Root_Window, text="Stop?").grid(row=3, column=0, columnspan=5) My_Label = Label(Controls_Box_Frame, text="Stop?").grid(row=3, column=0, columnspan=5)
global labels = [] global labels = []
labels.append(My_Label) labels.append(My_Label)
except: except:
@@ -69,7 +83,7 @@ def PiperTTS_GUI_Stop():
def PiperTTS_GUI_Previous(): def PiperTTS_GUI_Previous():
try: try:
PiperTTS_GUI_Hide_All_Labels() PiperTTS_GUI_Hide_All_Labels()
My_Label = Label(Root_Window, text="Previous?").grid(row=3, column=0, columnspan=5) My_Label = Label(Controls_Box_Frame, text="Previous?").grid(row=3, column=0, columnspan=5)
global labels = [] global labels = []
labels.append(My_Label) labels.append(My_Label)
except: except:
@@ -79,7 +93,7 @@ def PiperTTS_GUI_Previous():
def PiperTTS_GUI_Next(): def PiperTTS_GUI_Next():
try: try:
PiperTTS_GUI_Hide_All_Labels() PiperTTS_GUI_Hide_All_Labels()
My_Label = Label(Root_Window, text="Next?").grid(row=3, column=0, columnspan=5) My_Label = Label(Controls_Box_Frame, text="Next?").grid(row=3, column=0, columnspan=5)
global labels = [] global labels = []
labels.append(My_Label) labels.append(My_Label)
except: except:
@@ -89,7 +103,7 @@ def PiperTTS_GUI_Next():
def PiperTTS_GUI_Clipboard(): def PiperTTS_GUI_Clipboard():
try: try:
PiperTTS_GUI_Hide_All_Labels() PiperTTS_GUI_Hide_All_Labels()
My_Label = Label(Root_Window, text="Clipboard?").grid(row=3, column=0, columnspan=5) My_Label = Label(Controls_Box_Frame, text="Clipboard?").grid(row=3, column=0, columnspan=5)
global labels = [] global labels = []
labels.append(My_Label) labels.append(My_Label)
except: except:
@@ -104,12 +118,12 @@ def PiperTTS_GUI_Hide_All_Labels():
print("An exception occurred - when attempting to hide previous messages.") print("An exception occurred - when attempting to hide previous messages.")
# Creating Buttons # Creating Buttons
C_Button_Clipboard = Button(Root_Window, text="📋", pady=20, padx=30, command=PiperTTS_GUI_Clipboard) C_Button_Clipboard = Button(Controls_Box_Frame, text="📋", pady=20, padx=30, command=PiperTTS_GUI_Clipboard)
C_Button_Play = Button(Root_Window, text="", pady=20, padx=30, command=PiperTTS_GUI_Play) C_Button_Play = Button(Controls_Box_Frame, text="", pady=20, padx=30, command=PiperTTS_GUI_Play)
C_Button_Pause = Button(Root_Window, text="", pady=20, padx=30, command=PiperTTS_GUI_Pause) C_Button_Pause = Button(Controls_Box_Frame, text="", pady=20, padx=30, command=PiperTTS_GUI_Pause)
C_Button_Stop = Button(Root_Window, text="", pady=20, padx=30, command=PiperTTS_GUI_Stop) C_Button_Stop = Button(Controls_Box_Frame, text="", pady=20, padx=30, command=PiperTTS_GUI_Stop)
C_Button_previous = Button(Root_Window, text="", pady=20, padx=30, command=PiperTTS_GUI_Previous) C_Button_previous = Button(Controls_Box_Frame, text="", pady=20, padx=30, command=PiperTTS_GUI_Previous)
C_Button_Next = Button(Root_Window, text="", pady=20, padx=30, command=PiperTTS_GUI_Next) C_Button_Next = Button(Controls_Box_Frame, text="", pady=20, padx=30, command=PiperTTS_GUI_Next)
# Aligning Buttons to grid # Aligning Buttons to grid
C_Button_Clipboard.grid(row=1, column=4) C_Button_Clipboard.grid(row=1, column=4)