### Basic CustomTkinter Window Setup Source: https://context7.com/minoosdpr/customtkinter/llms.txt Demonstrates how to create a full-screen CustomTkinter window by automatically detecting screen dimensions and adding a simple button. This is a foundational example for starting any CustomTkinter application. ```python from customtkinter import * window = CTk() width = window.winfo_screenwidth() height = window.winfo_screenheight() window.geometry(f'{width}x{height}+0+0') btn = CTkButton(window, text='click') btn.pack() window.mainloop() ``` -------------------------------- ### Entry Field with Callbacks and Input Handling in CustomTkinter Source: https://context7.com/minoosdpr/customtkinter/llms.txt Demonstrates building an interactive form with CustomTkinter entry fields. It includes functionality for command callbacks, retrieving user input, and clearing the entry field, showcasing basic form interaction. ```python from customtkinter import * from tkinter.messagebox import showinfo def check_btn(): text = name.get() showinfo('Result', f'عددی که وارد کردید{text}است') def delete_age(): name.delete(0, END) window = CTk() window.geometry('500x300') myfont = CTkFont(family='B Yekan', size=24, weight='bold') lbl_name = CTkLabel(window, text='چه عددی در ذهن شماست؟', font=myfont) name = CTkEntry(window, corner_radius=7, width=100, placeholder_text='number') btn = CTkButton(window, text='تشخیص بده', font=myfont, corner_radius=10, command=check_btn) del_btn = CTkButton(window, text='پاک کردن', font=myfont, corner_radius=10, command=delete_age) lbl_name.pack(pady=10) name.pack(pady=19) btn.pack(pady=20) del_btn.pack() window.mainloop() ``` -------------------------------- ### Label with Custom Font and Styling in CustomTkinter Source: https://context7.com/minoosdpr/customtkinter/llms.txt Shows how to display text labels with custom font families, sizes, and background colors using CustomTkinter. It also demonstrates setting text color and widget dimensions for advanced visual control. ```python from customtkinter import CTk, CTkFont, CTkLabel root = CTk() root.title('Label and font') root.geometry('500x400') font = CTkFont(family='B Titr', size=24) l = CTkLabel( root, text='سلام بر شما', width=50, height=10, text_color='red', font=font, fg_color='#003322' ) l.pack() root.mainloop() ``` -------------------------------- ### Python CustomTkinter: Dynamic ComboBox with Callbacks Source: https://context7.com/minoosdpr/customtkinter/llms.txt This snippet demonstrates creating a CustomTkinter ComboBox with a predefined list of colors. It includes a function to update the button's foreground color based on the selected item and another function to add new colors dynamically to the ComboBox. Dependencies include the 'customtkinter' library. ```python from customtkinter import * def set_color(choice): btn_setcolor.configure(fg_color=choice) def insert_color(): text = color_input.get() if text not in colors: colors.append(text) combo_color.configure(values=colors) color_input.delete(0, END) window = CTk() window.geometry('500x500') color_input = CTkEntry(window, placeholder_text='color: ') colors = ['red', 'silver', 'blue'] color = StringVar(value='default') combo_color = CTkComboBox( window, values=colors, variable=color, corner_radius=50, command=set_color, dropdown_hover_color='#FF00AA' ) btn_setcolor = CTkButton(window, text='set new color', command=insert_color) combo_color.pack(pady=20) color_input.pack(pady=10) btn_setcolor.pack() window.mainloop() ``` -------------------------------- ### Customizable Button Widget in CustomTkinter Source: https://context7.com/minoosdpr/customtkinter/llms.txt Illustrates the creation of a highly customized button in CustomTkinter, featuring options for border styling, hover effects, corner radius, and precise dimension control. This allows for visually rich interactive elements. ```python from customtkinter import * window = CTk() window.geometry('500x500') window.title('Button') btn = CTkButton( window, text='click', width=45, height=10, corner_radius=15, border_width=3, border_color='black', border_spacing=6, hover_color=('#88008B', '#556B7A'), text_color='black' ) btn.pack() window.mainloop() ``` -------------------------------- ### Checkbox State Management and Control in CustomTkinter Source: https://context7.com/minoosdpr/customtkinter/llms.txt Explains how to implement and manage the state of checkboxes in CustomTkinter using StringVar. It covers programmatic selection/deselection and dynamic text updates based on the checkbox state. ```python from customtkinter import * def clear_checkbox(): check.deselect() show_text.set('Not good ok?') def select(): check.select() show_text.set("Well... I'm good now") window = CTk() window.geometry('500x300') state = StringVar(value='yes') show_text = StringVar(value='Feel good?') check = CTkCheckBox( window, textvariable=show_text, onvalue='yes', offvalue='no', variable=state ) check.pack(pady=20) btn_clear = CTkButton(window, text='clear', command=clear_checkbox) btn_clear.pack() btn_select = CTkButton(window, text='select', command=select) btn_select.pack(pady=17) window.mainloop() ``` -------------------------------- ### Simulating Radio Buttons with Checkboxes in CustomTkinter Source: https://context7.com/minoosdpr/customtkinter/llms.txt Demonstrates a pattern for achieving mutually exclusive checkbox behavior, effectively simulating radio buttons. This is accomplished using command callbacks that deselect other checkboxes when one is selected. ```python from customtkinter import * def check_gender(): if male.get() == 'male': female.deselect() if female.get() == 'female': male.deselect() window = CTk() window.geometry('500x500') male = CTkCheckBox( window, onvalue='male', offvalue='off', text='male', command=check_gender ) female = CTkCheckBox( window, onvalue='female', offvalue='off', text='female', command=check_gender ) male.pack(side=RIGHT) female.pack(side=RIGHT) window.mainloop() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.