Add Uptated-Prototype/Class-Based-GUI-Test.py
This commit is contained in:
44
Uptated-Prototype/Class-Based-GUI-Test.py
Normal file
44
Uptated-Prototype/Class-Based-GUI-Test.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
class MyApp(tk.Tk):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.title("PiperTTS - Prototype GUI Class Based") # Sets the GUI Title
|
||||
Window_Width, Window_Height = 420, 570 # Defining Window Starting Size
|
||||
Screen_Width, Screen_Height = self.winfo_screenwidth(), self.winfo_screenheight() # Getting Screen Width and Height
|
||||
Window_PosX, Window_PosY = (Screen_Width/2) - (Window_Width/2), (Screen_Height/2) - (Window_Height/2) # Calculate Center of Screen for the window
|
||||
self.geometry(f'{Window_Width}x{Window_Height}+{int(Window_PosX)}+{int(Window_PosY)}') # Sets Window Size And Starting Position
|
||||
self..minsize(Window_Width, Window_Height) # Defining Window Minimum Size
|
||||
|
||||
self.MainTextWidget = MainTextWidget(self) # Creates Text input Frame
|
||||
|
||||
self.MainPlaybackWidget = MainPlaybackWidget(self) # Creates Playback button Frame
|
||||
|
||||
self.mainloop()
|
||||
|
||||
|
||||
class MainTextWidget(ttk.Frame):
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
self.pack(fill = "both", expand = True)
|
||||
|
||||
Input_Box = tk.Text(self, selectbackground="yellow", selectforeground="black", undo=True)
|
||||
Input_Box.pack(side = LEFT, padx=5, pady=5, expand = True, fill = "both")
|
||||
|
||||
class MainPlaybackWidget(ttk.Frame):
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
self.pack(fill = "both")
|
||||
|
||||
GUI_Button_PlayAndPause = ttk.Button(self, text="▶")
|
||||
GUI_Button_Stop = ttk.Button(self, text="⏹")
|
||||
GUI_Button_previous = ttk.Button(self, text="⏮")
|
||||
GUI_Button_Next = ttk.Button(self, text="⏭")
|
||||
|
||||
GUI_Button_PlayAndPause.grid(row=0, column=0)
|
||||
GUI_Button_previous.grid(row=0, column=1)
|
||||
GUI_Button_Stop.grid(row=0, column=2)
|
||||
GUI_Button_Next.grid(row=0, column=3)
|
||||
|
||||
MyApp()
|
||||
Reference in New Issue
Block a user