parent
3a1c972a2a
commit
97ab0aca33
@ -0,0 +1,129 @@
|
|||||||
|
from main import main, shutdown
|
||||||
|
import tkinter
|
||||||
|
import tkinter.messagebox
|
||||||
|
import customtkinter
|
||||||
|
|
||||||
|
customtkinter.set_appearance_mode("System") # Modes: "System" (standard), "Dark", "Light"
|
||||||
|
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
|
||||||
|
|
||||||
|
|
||||||
|
class App(customtkinter.CTk):
|
||||||
|
|
||||||
|
WIDTH = 780
|
||||||
|
HEIGHT = 520
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.title("Reddit Video Maker Bot GUI")
|
||||||
|
self.geometry(f"{App.WIDTH}x{App.HEIGHT}")
|
||||||
|
self.protocol("WM_DELETE_WINDOW", self.on_closing) # call .on_closing() when app gets closed
|
||||||
|
|
||||||
|
# ============ create two frames ============
|
||||||
|
|
||||||
|
# configure grid layout (2x1)
|
||||||
|
self.grid_columnconfigure(1, weight=1)
|
||||||
|
self.grid_rowconfigure(0, weight=1)
|
||||||
|
|
||||||
|
self.frame_left = customtkinter.CTkFrame(master=self,
|
||||||
|
width=180,
|
||||||
|
corner_radius=0)
|
||||||
|
self.frame_left.grid(row=0, column=0, sticky="nswe")
|
||||||
|
|
||||||
|
self.frame_right = customtkinter.CTkFrame(master=self)
|
||||||
|
self.frame_right.grid(row=0, column=1, sticky="nswe", padx=20, pady=20)
|
||||||
|
|
||||||
|
# ============ frame_left ============
|
||||||
|
|
||||||
|
# configure grid layout (1x11)
|
||||||
|
self.frame_left.grid_rowconfigure(0, minsize=10) # empty row with minsize as spacing
|
||||||
|
self.frame_left.grid_rowconfigure(5, weight=1) # empty row as spacing
|
||||||
|
self.frame_left.grid_rowconfigure(8, minsize=20) # empty row with minsize as spacing
|
||||||
|
self.frame_left.grid_rowconfigure(11, minsize=10) # empty row with minsize as spacing
|
||||||
|
|
||||||
|
self.label_1 = customtkinter.CTkLabel(master=self.frame_left,
|
||||||
|
text="Reddit Video Maker Bot",
|
||||||
|
text_font=("Roboto Medium", -16)) # font name and size in px
|
||||||
|
self.label_1.grid(row=1, column=0, pady=10, padx=10)
|
||||||
|
|
||||||
|
self.button_1 = customtkinter.CTkButton(master=self.frame_left,
|
||||||
|
text="Home",
|
||||||
|
command=self.button_event)
|
||||||
|
self.button_1.grid(row=2, column=0, pady=10, padx=20)
|
||||||
|
|
||||||
|
self.button_2 = customtkinter.CTkButton(master=self.frame_left,
|
||||||
|
text="Settings",
|
||||||
|
command=self.button_event)
|
||||||
|
self.button_2.grid(row=3, column=0, pady=10, padx=20)
|
||||||
|
|
||||||
|
self.button_3 = customtkinter.CTkButton(master=self.frame_left,
|
||||||
|
text="Results",
|
||||||
|
command=self.button_event)
|
||||||
|
self.button_3.grid(row=4, column=0, pady=10, padx=20)
|
||||||
|
|
||||||
|
self.label_mode = customtkinter.CTkLabel(master=self.frame_left, text="Appearance Mode:")
|
||||||
|
self.label_mode.grid(row=9, column=0, pady=0, padx=20, sticky="w")
|
||||||
|
|
||||||
|
self.optionmenu_1 = customtkinter.CTkOptionMenu(master=self.frame_left,
|
||||||
|
values=["Light", "Dark", "System"],
|
||||||
|
command=self.change_appearance_mode)
|
||||||
|
self.optionmenu_1.grid(row=10, column=0, pady=10, padx=20, sticky="w")
|
||||||
|
|
||||||
|
# ============ frame_right ============
|
||||||
|
|
||||||
|
# configure grid layout (3x7)
|
||||||
|
self.frame_right.rowconfigure((0, 1, 2, 3), weight=1)
|
||||||
|
self.frame_right.rowconfigure(7, weight=10)
|
||||||
|
self.frame_right.columnconfigure((0, 1), weight=1)
|
||||||
|
self.frame_right.columnconfigure(2, weight=0)
|
||||||
|
|
||||||
|
self.frame_info = customtkinter.CTkFrame(master=self.frame_right)
|
||||||
|
self.frame_info.grid(row=0, column=0, columnspan=2, rowspan=4, pady=20, padx=20, sticky="nsew")
|
||||||
|
|
||||||
|
# ============ frame_info ============
|
||||||
|
|
||||||
|
# configure grid layout (1x1)
|
||||||
|
self.frame_info.rowconfigure(0, weight=1)
|
||||||
|
self.frame_info.columnconfigure(0, weight=1)
|
||||||
|
|
||||||
|
self.label_info_1 = customtkinter.CTkLabel(master=self.frame_info,
|
||||||
|
text=" Thanks for using this tool! \n" +
|
||||||
|
"Feel free to contribute to this project on GitHub!\n"+
|
||||||
|
"If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue. \n"+
|
||||||
|
"You can find solutions to many common problems in the Documentation: https://reddit-video-maker-bot.netlify.app/" ,
|
||||||
|
height=100,
|
||||||
|
corner_radius=6, # <- custom corner radius
|
||||||
|
fg_color=("white", "gray38"), # <- custom tuple-color
|
||||||
|
justify=tkinter.LEFT)
|
||||||
|
self.label_info_1.grid(column=0, row=0, sticky="nwe", padx=15, pady=15)
|
||||||
|
|
||||||
|
self.progressbar = customtkinter.CTkProgressBar(master=self.frame_info)
|
||||||
|
self.progressbar.grid(row=1, column=0, sticky="ew", padx=15, pady=15)
|
||||||
|
|
||||||
|
|
||||||
|
# set default values
|
||||||
|
self.optionmenu_1.set("Dark")
|
||||||
|
###self.button_3.configure(state="disabled", text="Disabled CTkButton")
|
||||||
|
###self.combobox_1.set("CTkCombobox")
|
||||||
|
###self.radio_button_1.select()
|
||||||
|
###self.slider_1.set(0.2)
|
||||||
|
###self.slider_2.set(0.7)
|
||||||
|
###self.progressbar.set(0.5)
|
||||||
|
###self.switch_2.select()
|
||||||
|
###self.radio_button_3.configure(state=tkinter.DISABLED)
|
||||||
|
###self.check_box_1.configure(state=tkinter.DISABLED, text="CheckBox disabled")
|
||||||
|
###self.check_box_2.select()
|
||||||
|
|
||||||
|
def button_event(self):
|
||||||
|
print("Button pressed")
|
||||||
|
|
||||||
|
def change_appearance_mode(self, new_appearance_mode):
|
||||||
|
customtkinter.set_appearance_mode(new_appearance_mode)
|
||||||
|
|
||||||
|
def on_closing(self, event=0):
|
||||||
|
shutdown()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = App()
|
||||||
|
app.mainloop()
|
Loading…
Reference in new issue