forked from flatplanet/Intro-To-TKinter-Youtube-Course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttons_cust.py
30 lines (19 loc) · 1.02 KB
/
buttons_cust.py
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
from tkinter import *
import customtkinter
from PIL import Image, ImageTk
customtkinter.set_appearance_mode("dark") # Modes: system (default), light, dark
customtkinter.set_default_color_theme("dark-blue") # Themes: blue (default), dark-blue, green
root = customtkinter.CTk()
root.title('Codemy.com - Custom Buttons With Images')
root.iconbitmap('c:/gui/codemy.ico')
root.geometry("500x170")
# Define Our Images
add_folder_image = ImageTk.PhotoImage(Image.open("test_images/add-folder.png").resize((20,20), Image.ANTIALIAS))
add_list_image = ImageTk.PhotoImage(Image.open("test_images/add-list.png").resize((20,20), Image.ANTIALIAS))
# Create Our Buttons
button_1 = customtkinter.CTkButton(master=root, image=add_folder_image, text="Add Folder", width=190, height=40, compound="top")
button_1.pack(pady=20, padx=20)
button_2 = customtkinter.CTkButton(master=root, image=add_list_image, text="Add Item", width=190, height=40, compound="right",
fg_color="#D35B58", hover_color="#C77C78")
button_2.pack(pady=10, padx=20)
root.mainloop()