-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathctk_object_oriented.py
More file actions
32 lines (22 loc) · 846 Bytes
/
ctk_object_oriented.py
File metadata and controls
32 lines (22 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from tkinter import *
import customtkinter
# Set the theme and color options
customtkinter.set_appearance_mode("dark") # Modes: system (default), light, dark
customtkinter.set_default_color_theme("dark-blue") # Themes: blue (default), dark-blue, green
class App(customtkinter.CTk):
def __init__(self):
super().__init__()
#root = customtkinter.CTk()
self.title('Tkinter.com - Object Oriented CustomTkinter')
self.iconbitmap('images/codemy.ico')
self.geometry('700x450')
# Text Box
self.my_text = customtkinter.CTkTextbox(self, width=600, height=300)
self.my_text.pack(pady=20)
self.my_button = customtkinter.CTkButton(self, text="Clear Box", command=self.clear)
self.my_button.pack(pady=20)
def clear(self):
self.my_text.delete('0.0', END)
# Define app and Create our app's mainloop
app = App()
app.mainloop()