Update Uptated-Prototype/PiperTTS-GUI-Test.py
This commit is contained in:
@@ -5,7 +5,7 @@ import atexit
|
||||
Root_Window = Tk()
|
||||
Root_Window.title("PiperTTS - Prototype GUI") # Sets the GUI Title
|
||||
|
||||
# Setting up Window Starting Size and Position
|
||||
# Setting up Window Starting Size and Position (can only be even numbers)
|
||||
Window_Width = 426
|
||||
Window_Height = 576
|
||||
# Getting Screen Width and Height
|
||||
@@ -14,33 +14,37 @@ Screen_Height = Root_Window.winfo_screenheight()
|
||||
# Calculate Center of Screen for the window
|
||||
Window_PosX = (Screen_Width/2) - (Window_Width/2)
|
||||
Window_PosY = (Screen_Height/2) - (Window_Height/2)
|
||||
# Setting up Window in Center
|
||||
Root_Window.geometry(f'{Window_Width}x{Window_Height}+{int(Window_PosX)}+{int(Window_PosY)}') # Sets the GUI geometry
|
||||
# Sets the GUI geometry and attempts to centers window on screen
|
||||
Root_Window.geometry(f'{Window_Width}x{Window_Height}+{int(Window_PosX)}+{int(Window_PosY)}')
|
||||
#Root_Window.minsize(Window_Width, Window_Height)
|
||||
|
||||
# Attempts to make a Input box
|
||||
# Attempts to create a Input Frame
|
||||
try:
|
||||
Input_Box_Frame = Frame(Root_Window)
|
||||
except:
|
||||
print("An exception occurred - when creating input Frame.")
|
||||
|
||||
# Attempts to create a Controls Frame
|
||||
try:
|
||||
Controls_Box_Frame = Frame(Root_Window)
|
||||
except:
|
||||
print("An exception occurred - when creating Controls Frame.")
|
||||
|
||||
# Attempts to Place Input and Controls frames
|
||||
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)
|
||||
Input_Box_Frame.place(x = 0, y = 0, relwidth = 1, relheight = 0.7)
|
||||
Controls_Box_Frame.place(x = 0, rely = 0.8, relwidth = 1, relheight = 0.7)
|
||||
except:
|
||||
print("An exception occurred - when placing Frames.")
|
||||
|
||||
# Attempts to create a Input box
|
||||
try:
|
||||
Input_Box = Text(Input_Box_Frame)
|
||||
Input_Box.pack(padx=20, pady=20, expand = True, fill = "both")
|
||||
except:
|
||||
print("An exception occurred - when creating input box.")
|
||||
|
||||
# Attempts to create a scrollbar for the Input box
|
||||
try:
|
||||
Main_Text_Scrollbar = Scrollbar(Input_Box_Frame, command = Input_Box_Frame.yview)
|
||||
Input_Box_Frame.configure(yscrollcommand = Main_Text_Scrollbar.set)
|
||||
@@ -51,57 +55,51 @@ except:
|
||||
#
|
||||
def PiperTTS_GUI_Play():
|
||||
try:
|
||||
#PiperTTS_GUI_Hide_All_Labels()
|
||||
My_Label = Label(Controls_Box_Frame, text="Playing?").grid(row=3, column=0, columnspan=5)
|
||||
#global labels = []
|
||||
labels.append(My_Label)
|
||||
My_Test_Label["text"] = "Playing?"
|
||||
C_Button_Pause["state"] == "normal"
|
||||
C_Button_Pause["state"] = "disabled"
|
||||
C_Button_Play["state"] = "disabled"
|
||||
except:
|
||||
print("An exception occurred - when pressing Play Button.")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Pause():
|
||||
try:
|
||||
#PiperTTS_GUI_Hide_All_Labels()
|
||||
My_Label = Label(Controls_Box_Frame, text="Pause?").grid(row=3, column=0, columnspan=5)
|
||||
#global labels = []
|
||||
labels.append(My_Label)
|
||||
My_Test_Label["text"] = "Pause?"
|
||||
C_Button_Pause["state"] == "disabled"
|
||||
C_Button_Pause["state"] = "normal"
|
||||
C_Button_Play["state"] = "normal"
|
||||
except:
|
||||
print("An exception occurred - when pressing Pause Button.")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Stop():
|
||||
try:
|
||||
#PiperTTS_GUI_Hide_All_Labels()
|
||||
My_Label = Label(Controls_Box_Frame, text="Stop?").grid(row=3, column=0, columnspan=5)
|
||||
#global labels = []
|
||||
labels.append(My_Label)
|
||||
My_Test_Label["text"] = "Stop?"
|
||||
C_Button_Pause["state"] == "disabled"
|
||||
C_Button_Play["state"] = "normal"
|
||||
except:
|
||||
print("An exception occurred - when pressing Stop Button.")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Previous():
|
||||
try:
|
||||
#PiperTTS_GUI_Hide_All_Labels()
|
||||
My_Label = Label(Controls_Box_Frame, text="Previous?").grid(row=3, column=0, columnspan=5)
|
||||
#global labels = []
|
||||
labels.append(My_Label)
|
||||
My_Test_Label["text"] = "Previous?"
|
||||
except:
|
||||
print("An exception occurred - when pressing Previous Button.")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Next():
|
||||
try:
|
||||
#PiperTTS_GUI_Hide_All_Labels()
|
||||
My_Label = Label(Controls_Box_Frame, text="Next?").grid(row=3, column=0, columnspan=5)
|
||||
#global labels = []
|
||||
labels.append(My_Label)
|
||||
My_Test_Label["text"] = "Next?"
|
||||
except:
|
||||
print("An exception occurred - when pressing Next Button.")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_New_File():
|
||||
try:
|
||||
My_Test_Label["text"] = "New File?"
|
||||
Input_Box.delete("1.0", END)
|
||||
except:
|
||||
print("An exception occurred - when pressing New File Button.")
|
||||
'''
|
||||
#
|
||||
def PiperTTS_GUI_Clipboard():
|
||||
try:
|
||||
@@ -119,22 +117,38 @@ def PiperTTS_GUI_Hide_All_Labels():
|
||||
label.destroy()
|
||||
except:
|
||||
print("An exception occurred - when attempting to hide previous messages.")
|
||||
|
||||
'''
|
||||
# Creating Buttons
|
||||
C_Button_Clipboard = Button(Controls_Box_Frame, text="📋", pady=20, padx=30, command=PiperTTS_GUI_Clipboard)
|
||||
C_Button_Play = Button(Controls_Box_Frame, text="▶", pady=20, padx=30, command=PiperTTS_GUI_Play)
|
||||
C_Button_Pause = Button(Controls_Box_Frame, text="⏸", pady=20, padx=30, command=PiperTTS_GUI_Pause)
|
||||
C_Button_Stop = Button(Controls_Box_Frame, text="⏹", pady=20, padx=30, command=PiperTTS_GUI_Stop)
|
||||
C_Button_previous = Button(Controls_Box_Frame, text="⏮", pady=20, padx=30, command=PiperTTS_GUI_Previous)
|
||||
C_Button_Next = Button(Controls_Box_Frame, text="⏭", pady=20, padx=30, command=PiperTTS_GUI_Next)
|
||||
#C_Button_Clipboard = Button(Controls_Box_Frame, text="📋", pady=10, padx=10, command=PiperTTS_GUI_Clipboard)
|
||||
C_Button_Play = Button(Controls_Box_Frame, text="▶", pady=10, padx=10, command=PiperTTS_GUI_Play)
|
||||
C_Button_Pause = Button(Controls_Box_Frame, text="⏸", pady=10, padx=10, command=PiperTTS_GUI_Pause)
|
||||
C_Button_Stop = Button(Controls_Box_Frame, text="⏹", pady=10, padx=10, command=PiperTTS_GUI_Stop)
|
||||
C_Button_previous = Button(Controls_Box_Frame, text="⏮", pady=10, padx=10, command=PiperTTS_GUI_Previous)
|
||||
C_Button_Next = Button(Controls_Box_Frame, text="⏭", pady=10, padx=10, command=PiperTTS_GUI_Next)
|
||||
|
||||
# Creating a Test Text Label
|
||||
My_Test_Label = Label(Controls_Box_Frame, text="Test Text?", anchor="center")
|
||||
My_Test_Label.grid(row=0, column=0, columnspan=4)
|
||||
|
||||
# Aligning Buttons to grid
|
||||
C_Button_Clipboard.grid(row=1, column=4)
|
||||
C_Button_Play.grid(row=2, column=0)
|
||||
C_Button_Pause.grid(row=2, column=1)
|
||||
C_Button_Stop.grid(row=2, column=2)
|
||||
C_Button_previous.grid(row=2, column=3)
|
||||
C_Button_Next.grid(row=2, column=4)
|
||||
#C_Button_Clipboard.grid(row=1, column=4)
|
||||
C_Button_Play.grid(row=1, column=0)
|
||||
C_Button_Pause.grid(row=1, column=1)
|
||||
C_Button_Stop.grid(row=1, column=2)
|
||||
C_Button_previous.grid(row=1, column=3)
|
||||
C_Button_Next.grid(row=1, column=4)
|
||||
|
||||
#Creating Toolbar menu
|
||||
Root_Toolbar = menu(Root_Window)
|
||||
Root_Window.configure(menu=Root_Toolbar)
|
||||
#Creating File menu for Toolbar
|
||||
File_Toolbar = menu(Root_Toolbar, tearoff=False)
|
||||
Root_Toolbar.add_cascade(label="File", menu=File_Toolbar)
|
||||
File_Toolbar.addcommand(label="New", command=PiperTTS_GUI_New_File)
|
||||
File_Toolbar.addcommand(label="Open")
|
||||
File_Toolbar.addcommand(label="Save")
|
||||
File_Toolbar.add_seperator()
|
||||
File_Toolbar.addcommand(label="Exit", command=Root_Window.quit)
|
||||
|
||||
# End of Code - Emd of Tkinter loop
|
||||
Root_Window.mainloop()
|
||||
|
||||
Reference in New Issue
Block a user