Update Uptated-Prototype/PiperTTS-GUI-Test.py
This commit is contained in:
@@ -25,30 +25,35 @@ Root_Window.geometry(f'{Window_Width}x{Window_Height}+{int(Window_PosX)}+{int(Wi
|
||||
# Attempts to create a Input Frame
|
||||
try:
|
||||
Input_Box_Frame = Frame(Root_Window)
|
||||
except:
|
||||
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 = Frame(Root_Window)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when creating Controls Frame.")
|
||||
# Attempts to create a Prefrences Frame
|
||||
try:
|
||||
Prefrences_Frame = Frame(Root_Window)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
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.7)
|
||||
Controls_Box_Frame.place(x = 0, rely = 0.8, relwidth = 1, relheight = 0.7)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when placing Frames.")
|
||||
|
||||
# Attempts to create a Input box
|
||||
try:
|
||||
Input_Box = Text(Input_Box_Frame, selectbackground="yellow", selectforeground="black", undo=True)
|
||||
Input_Box.pack(padx=5, pady=5, expand = True, fill = "both")
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when creating input box.")
|
||||
|
||||
# Attempts to create a scrollbar for the Input box
|
||||
@@ -56,7 +61,8 @@ try:
|
||||
Main_Text_Scrollbar = Scrollbar(Input_Box_Frame, command = Input_Box_Frame.yview)
|
||||
Input_Box_Frame.configure(yscrollcommand = Main_Text_Scrollbar.set)
|
||||
Main_Text_Scrollbar.place(relx = 1, rely = 0, relheight = 1, anchor = "ne")
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when creating a scroll bar.")
|
||||
|
||||
#
|
||||
@@ -65,7 +71,8 @@ def PiperTTS_GUI_Play():
|
||||
My_Test_Label["text"] = "Playing?"
|
||||
C_Button_Pause["state"] == "normal"
|
||||
C_Button_Play["state"] = "disabled"
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Play Button.")
|
||||
|
||||
#
|
||||
@@ -74,7 +81,8 @@ def PiperTTS_GUI_Pause():
|
||||
My_Test_Label["text"] = "Pause?"
|
||||
C_Button_Pause["state"] == "disabled"
|
||||
C_Button_Play["state"] = "normal"
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Pause Button.")
|
||||
|
||||
#
|
||||
@@ -83,21 +91,24 @@ def PiperTTS_GUI_Stop():
|
||||
My_Test_Label["text"] = "Stop?"
|
||||
C_Button_Pause["state"] == "disabled"
|
||||
C_Button_Play["state"] = "normal"
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Stop Button.")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Previous():
|
||||
try:
|
||||
My_Test_Label["text"] = "Previous?"
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Previous Button.")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Next():
|
||||
try:
|
||||
My_Test_Label["text"] = "Next?"
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Next Button.")
|
||||
|
||||
#
|
||||
@@ -105,7 +116,8 @@ def PiperTTS_GUI_New_File():
|
||||
try:
|
||||
My_Test_Label["text"] = "New File?"
|
||||
Input_Box.delete("1.0", "end-1c")
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing New File Button.")
|
||||
|
||||
#
|
||||
@@ -117,7 +129,8 @@ def PiperTTS_GUI_Get_Selection():
|
||||
else:
|
||||
Cursor_Position = Input_Box.index(INSERT)
|
||||
Input_Box.insert(Cursor_Position, Selected)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when grabbing Selection.")
|
||||
|
||||
#
|
||||
@@ -129,7 +142,8 @@ def PiperTTS_GUI_Get_Clipboard():
|
||||
else:
|
||||
Cursor_Position = Input_Box.index(INSERT)
|
||||
Input_Box.insert(Cursor_Position, Selected)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when grabbing Clipboard.")
|
||||
#
|
||||
def PiperTTS_GUI_TextFile_Open():
|
||||
@@ -145,7 +159,8 @@ def PiperTTS_GUI_TextFile_Open():
|
||||
Test_var.set("There are {}, lines".format(len(Input_Box.get("1.0","end-1c").splitlines())))
|
||||
else:
|
||||
print("Canceled file dialog.")
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when Opening Text File.")
|
||||
#
|
||||
def PiperTTS_GUI_Reverse_Text():
|
||||
@@ -153,7 +168,8 @@ def PiperTTS_GUI_Reverse_Text():
|
||||
TempText = Input_Box.get("1.0","end-1c")
|
||||
Input_Box.delete("1.0", "end-1c")
|
||||
Input_Box.insert("1.0", TempText[::-1])
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when reversing text.")
|
||||
#
|
||||
def PiperTTS_GUI_Randomize_Text():
|
||||
@@ -166,7 +182,8 @@ def PiperTTS_GUI_Randomize_Text():
|
||||
Input_Box.insert("1.0", ''.join(TempList))
|
||||
end_time = time.time()
|
||||
print(f'Elapsed Time: {end_time - start_time} seconds')
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when Randomizing text.")
|
||||
#
|
||||
def PiperTTS_GUI_Randomize_Text_2nd():
|
||||
@@ -177,7 +194,8 @@ def PiperTTS_GUI_Randomize_Text_2nd():
|
||||
Input_Box.insert("1.0", "".join(random.sample(TempText, len(TempText))))
|
||||
end_time = time.time()
|
||||
print(f'Elapsed Time: {end_time - start_time} seconds')
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when Randomizing text.")
|
||||
#
|
||||
def PiperTTS_GUI_Set_Prefrences():
|
||||
@@ -185,7 +203,8 @@ def PiperTTS_GUI_Set_Prefrences():
|
||||
Input_Box_Frame.place_forget()
|
||||
Controls_Box_Frame.place_forget()
|
||||
Prefrences_Frame.place(x = 0, y = 0, relwidth = 1, relheight = 1)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when Setting prefrences.")
|
||||
|
||||
|
||||
@@ -197,14 +216,16 @@ def PiperTTS_GUI_Clipboard():
|
||||
My_Label = Label(Controls_Box_Frame, text="Clipboard?").grid(row=3, column=0, columnspan=5)
|
||||
#global labels = []
|
||||
labels.append(My_Label)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Clipboard Button.")
|
||||
# Deleting info messages
|
||||
def PiperTTS_GUI_Hide_All_Labels():
|
||||
try:
|
||||
for label in labels:
|
||||
label.destroy()
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when attempting to hide previous messages.")
|
||||
'''
|
||||
# Creating Buttons
|
||||
@@ -222,7 +243,8 @@ My_Test_Label.grid(row=0, column=0, columnspan=4)
|
||||
try:
|
||||
Test_var = StringVar(value = "0")
|
||||
Test_var.set("There are {}, lines".format(len(Input_Box.get("1.0","end-1c").splitlines())))
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("Mkay did not work.")
|
||||
#
|
||||
def OnKeyPress(event):
|
||||
@@ -256,9 +278,11 @@ try:
|
||||
#MyTestText = Input_Box.get("1.0","end-1c")
|
||||
#MyTestText2 = "There are {}, lines".format(len(Input_Box.get("1.0","end-1c").splitlines()))
|
||||
My_Test_Label2["text"] = "There are {}, lines".format(len(Input_Box.get("1.0","end-1c").splitlines()))
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("Fuckup again.")
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - trying to count like dracula.")
|
||||
'''
|
||||
My_Test_Label2.grid(row=2, column=0, columnspan=4)
|
||||
|
||||
Reference in New Issue
Block a user