diff --git a/Uptated-Prototype/PiperTTS-GUI-Test.py b/Uptated-Prototype/PiperTTS-GUI-Test.py index 3712e48..7bdf440 100644 --- a/Uptated-Prototype/PiperTTS-GUI-Test.py +++ b/Uptated-Prototype/PiperTTS-GUI-Test.py @@ -3,6 +3,7 @@ from tkinter import ttk from tkinter import filedialog import atexit import random +import time # Start of Code - Start of Tkinter loop Root_Window = Tk() @@ -157,11 +158,25 @@ def PiperTTS_GUI_Reverse_Text(): # def PiperTTS_GUI_Randomize_Text(): try: + start_time = time.time() TempText = Input_Box.get("1.0","end-1c") Input_Box.delete("1.0", "end-1c") TempList = list(TempText) random.shuffle(TempList) Input_Box.insert("1.0", ''.join(TempList)) + end_time = time.time() + print(f'Elapsed Time: {end_time - start_time} seconds') + except: + print("An exception occurred - when Randomizing text.") +# +def PiperTTS_GUI_Randomize_Text_2nd(): + try: + start_time = time.time() + TempText = Input_Box.get("1.0","end-1c") + Input_Box.delete("1.0", "end-1c") + Input_Box.insert("1.0", "".join(random.sample(mylist, len(mylist)))) + end_time = time.time() + print(f'Elapsed Time: {end_time - start_time} seconds') except: print("An exception occurred - when Randomizing text.") # @@ -241,10 +256,10 @@ C_Button_previous.grid(row=1, column=3) C_Button_Next.grid(row=1, column=4) # Prefrences stuff -GUI_Combobox_1_Label = Label(Prefrences_Frame, text="Language?", side = LEFT) -GUI_Combobox_1 = ttk.Combobox(Prefrences_Frame, side = LEFT) -GUI_Combobox_2_Label = Label(Prefrences_Frame, text="Voice?", side = LEFT) -GUI_Combobox_2 = ttk.Combobox(Prefrences_Frame, side = LEFT) +GUI_Combobox_1_Label = Label(Prefrences_Frame, text="Language?") +GUI_Combobox_1 = ttk.Combobox(Prefrences_Frame) +GUI_Combobox_2_Label = Label(Prefrences_Frame, text="Voice?") +GUI_Combobox_2 = ttk.Combobox(Prefrences_Frame) GUI_Spinbox_1_Label = Label(Prefrences_Frame, text="volume?") GUI_Spinbox_1 = ttk.Spinbox(Prefrences_Frame, from_ = 1, to = 100) GUI_Spinbox_2_Label = Label(Prefrences_Frame, text="length_scale?") @@ -255,10 +270,10 @@ GUI_Spinbox_4_Label = Label(Prefrences_Frame, text="noise_w_scale?") GUI_Spinbox_4 = ttk.Spinbox(Prefrences_Frame, from_ = 1.0, to = 2.0) GUI_Checkbutton_1 = ttk.Checkbutton(Prefrences_Frame, text="normalize_audio?") # Prefrences placement -GUI_Combobox_1_Label.pack() -GUI_Combobox_1.pack() -GUI_Combobox_2_Label.pack() -GUI_Combobox_2.pack() +GUI_Combobox_1_Label.pack(side = LEFT) +GUI_Combobox_1.pack(side = LEFT) +GUI_Combobox_2_Label.pack(side = LEFT) +GUI_Combobox_2.pack(side = LEFT) GUI_Spinbox_1_Label.pack() GUI_Spinbox_1.pack() GUI_Spinbox_2_Label.pack() @@ -295,6 +310,7 @@ Tools_Toolbar.add_command(label="Insert Selection", command=PiperTTS_GUI_Get_Sel Tools_Toolbar.add_command(label="Insert Clipboard", command=PiperTTS_GUI_Get_Clipboard) Tools_Toolbar.add_separator() Tools_Toolbar.add_command(label="Randomize Text", command=PiperTTS_GUI_Randomize_Text) +Tools_Toolbar.add_command(label="Randomize Text 2nd", command=PiperTTS_GUI_Randomize_Text_2nd) Tools_Toolbar.add_command(label="Reverse Text", command=PiperTTS_GUI_Reverse_Text) Tools_Toolbar.add_separator() Tools_Toolbar.add_command(label="Prefrences", command=PiperTTS_GUI_Set_Prefrences)