diff --git a/Uptated-Prototype/PiperTTS-GUI-Test.py b/Uptated-Prototype/PiperTTS-GUI-Test.py index ebe6670..c208b9e 100644 --- a/Uptated-Prototype/PiperTTS-GUI-Test.py +++ b/Uptated-Prototype/PiperTTS-GUI-Test.py @@ -22,6 +22,25 @@ Window_PosY = (Screen_Height/2) - (Window_Height/2) Root_Window.geometry(f'{Window_Width}x{Window_Height}+{int(Window_PosX)}+{int(Window_PosY)}') #Root_Window.minsize(Window_Width, Window_Height) +# +try: + with open("voices/voices.json","r") as file: + data = json.load(file) +# Failed at loading voices.json +except FileNotFoundError: + print("Error: The file 'voises.json' was not found.") + +# Create a list for Languages +mylist = ("Languages") + +# Appends and formats all the languages to the list +for voice_id, info in data.items(): + mylist.append(f"{info["language"]["name_native"]} ({info["language"]["name_english"]}, {info["language"]["country_english"]})") + +# Removes duplicate languages choices from list +mylist = list(dict.fromkeys(mylist)) +mylist_String = StringVar(value = "Languages") + # Attempts to create a Input Frame try: Input_Box_Frame = ttk.Frame(Root_Window) @@ -297,7 +316,10 @@ C_Button_Next.grid(row=1, column=4) # Prefrences stuff GUI_Combobox_1_Label = Label(Prefrences_Frame, text="Language?") -GUI_Combobox_1 = ttk.Combobox(Prefrences_Frame) +GUI_Combobox_1 = ttk.Combobox(Prefrences_Frame, textvariable = mylist_String) +# +GUI_Combobox_1["values"] = mylist +# 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?")