Update Uptated-Prototype/PiperTTS-GUI-Test.py
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
from tkinter import ttk
|
||||||
|
from tkinter import filedialog
|
||||||
import atexit
|
import atexit
|
||||||
|
|
||||||
# Start of Code - Start of Tkinter loop
|
# Start of Code - Start of Tkinter loop
|
||||||
@@ -104,20 +106,40 @@ def PiperTTS_GUI_New_File():
|
|||||||
#
|
#
|
||||||
def PiperTTS_GUI_Get_Selection():
|
def PiperTTS_GUI_Get_Selection():
|
||||||
try:
|
try:
|
||||||
Cursor_Position = Input_Box.index(INSERT)
|
|
||||||
Selected = Root_Window.selection_get()
|
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:
|
except:
|
||||||
print("An exception occurred - when grabbing Selection.")
|
print("An exception occurred - when grabbing Selection.")
|
||||||
|
|
||||||
#
|
#
|
||||||
def PiperTTS_GUI_Get_Clipboard():
|
def PiperTTS_GUI_Get_Clipboard():
|
||||||
try:
|
try:
|
||||||
Cursor_Position = Input_Box.index(INSERT)
|
|
||||||
Selected = Root_Window.clipboard_get()
|
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:
|
except:
|
||||||
print("An exception occurred - when grabbing Clipboard.")
|
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)
|
File_Toolbar = Menu(Root_Toolbar, tearoff=False)
|
||||||
Root_Toolbar.add_cascade(label="File", menu=File_Toolbar)
|
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="New", command=PiperTTS_GUI_New_File)
|
||||||
File_Toolbar.add_command(label="Open")
|
File_Toolbar.add_command(label="Open", command=PiperTTS_GUI_TextFile_Open)
|
||||||
File_Toolbar.add_command(label="Save")
|
File_Toolbar.add_command(label="Save as Wave")
|
||||||
File_Toolbar.add_separator()
|
File_Toolbar.add_separator()
|
||||||
File_Toolbar.add_command(label="Exit", command=Root_Window.quit)
|
File_Toolbar.add_command(label="Exit", command=Root_Window.quit)
|
||||||
#Creating Playback menu for Toolbar
|
#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 Selection", command=PiperTTS_GUI_Get_Selection)
|
||||||
Tools_Toolbar.add_command(label="Insert Clipboard", command=PiperTTS_GUI_Get_Clipboard)
|
Tools_Toolbar.add_command(label="Insert Clipboard", command=PiperTTS_GUI_Get_Clipboard)
|
||||||
Tools_Toolbar.add_separator()
|
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
|
# End of Code - Emd of Tkinter loop
|
||||||
Root_Window.mainloop()
|
Root_Window.mainloop()
|
||||||
|
|||||||
Reference in New Issue
Block a user