From 5894fd4926e1ed9e84cad36b71d0437f94a02a2a Mon Sep 17 00:00:00 2001 From: "DHR.Mike" Date: Sat, 6 Dec 2025 10:32:24 -0800 Subject: [PATCH] Update Uptated-Prototype/PiperTTS-GUI-Test.py --- Uptated-Prototype/PiperTTS-GUI-Test.py | 36 +++++++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/Uptated-Prototype/PiperTTS-GUI-Test.py b/Uptated-Prototype/PiperTTS-GUI-Test.py index 67dfa65..07c6381 100644 --- a/Uptated-Prototype/PiperTTS-GUI-Test.py +++ b/Uptated-Prototype/PiperTTS-GUI-Test.py @@ -1,4 +1,6 @@ from tkinter import * +from tkinter import ttk +from tkinter import filedialog import atexit # Start of Code - Start of Tkinter loop @@ -104,20 +106,40 @@ def PiperTTS_GUI_New_File(): # def PiperTTS_GUI_Get_Selection(): try: - Cursor_Position = Input_Box.index(INSERT) Selected = Root_Window.selection_get() - Input_Box.insert(Cursor_Position, Selected) + if not Selected: + My_Test_Label["text"] = "No text Selected" + else: + Cursor_Position = Input_Box.index(INSERT) + Input_Box.insert(Cursor_Position, Selected) except: print("An exception occurred - when grabbing Selection.") # def PiperTTS_GUI_Get_Clipboard(): try: - Cursor_Position = Input_Box.index(INSERT) Selected = Root_Window.clipboard_get() - Input_Box.insert(Cursor_Position, Selected) + if not Selected: + My_Test_Label["text"] = "No text in clipboard" + else: + Cursor_Position = Input_Box.index(INSERT) + Input_Box.insert(Cursor_Position, Selected) except: print("An exception occurred - when grabbing Clipboard.") +# +def PiperTTS_GUI_TextFile_Open(): + try: + root.filename = filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("Text files","*.txt"),("all files","*.*"))) + print(root.filename) + except: + print("An exception occurred - when Opening Text File.") +# +def PiperTTS_GUI_Set_Prefrences(): + try: + pass + except: + print("An exception occurred - when Setting prefrences.") + ''' # @@ -164,8 +186,8 @@ Root_Window.configure(menu=Root_Toolbar) File_Toolbar = Menu(Root_Toolbar, tearoff=False) Root_Toolbar.add_cascade(label="File", menu=File_Toolbar) File_Toolbar.add_command(label="New", command=PiperTTS_GUI_New_File) -File_Toolbar.add_command(label="Open") -File_Toolbar.add_command(label="Save") +File_Toolbar.add_command(label="Open", command=PiperTTS_GUI_TextFile_Open) +File_Toolbar.add_command(label="Save as Wave") File_Toolbar.add_separator() File_Toolbar.add_command(label="Exit", command=Root_Window.quit) #Creating Playback menu for Toolbar @@ -182,7 +204,7 @@ Root_Toolbar.add_cascade(label="Tools", menu=Tools_Toolbar) Tools_Toolbar.add_command(label="Insert Selection", command=PiperTTS_GUI_Get_Selection) Tools_Toolbar.add_command(label="Insert Clipboard", command=PiperTTS_GUI_Get_Clipboard) Tools_Toolbar.add_separator() -Tools_Toolbar.add_command(label="Prefrences") +Tools_Toolbar.add_command(label="Prefrences", command=PiperTTS_GUI_Set_Prefrences) # End of Code - Emd of Tkinter loop Root_Window.mainloop()