A modern messagebox for customtkinter
Project description
CTkMessagebox
A modern and fully customizable messagebox for customtkinter
Features:
- Customize all elements inside the messagebox
- Add custom icons or images
- Spawns at center of the screen
- Add multiple buttons according to your wish
- No ugly looking header or borders
- Comes with 5 default icons
- Draggable window
Installation
pip install CTkMessagebox
Latest version: 1.2
How it looks?
Example
from CTkMessagebox import CTkMessagebox
import customtkinter
def show_info():
# Default messagebox for showing some information
CTkMessagebox(title="Info", message="This is a CTkMessagebox!")
def show_checkmark():
# Show some positive message with the checkmark icon
CTkMessagebox(message="CTkMessagebox is successfully installed.",
icon="check", option_1="Thanks")
def show_error():
# Show some error message
CTkMessagebox(title="Error", message="Something went wrong!!!", icon="cancel")
def show_warning():
# Show some retry/cancel warnings
msg = CTkMessagebox(title="Warning Message!", message="Unable to connect!",
icon="warning", option_1="Cancel", option_2="Retry")
if msg.get()=="Retry":
show_warning()
def ask_question():
# get yes/no answers
msg = CTkMessagebox(title="Exit?", message="Do you want to close the program?",
icon="question", option_1="Cancel", option_2="No", option_3="Yes")
response = msg.get()
if response=="Yes":
app.destroy()
else:
print("Click 'Yes' to exit!")
app = customtkinter.CTk()
app.rowconfigure((0,1,2,3,4,5), weight=1)
app.columnconfigure(0, weight=1)
app.minsize(200,250)
customtkinter.CTkLabel(app, text="CTk Messagebox Examples").grid(padx=20)
customtkinter.CTkButton(app, text="Check CTkMessagebox", command=show_checkmark).grid(padx=20, pady=10, sticky="news")
customtkinter.CTkButton(app, text="Show Info", command=show_info).grid(padx=20, pady=10, sticky="news")
customtkinter.CTkButton(app, text="Show Error", command=show_error).grid(padx=20, pady=10, sticky="news")
customtkinter.CTkButton(app, text="Show Warning", command=show_warning).grid(padx=20, pady=10, sticky="news")
customtkinter.CTkButton(app, text="Ask Question", command=ask_question).grid(padx=20, pady=(10,20), sticky="news")
app.mainloop()
OPTIONS
Parameters | Description |
---|---|
width | width of the window in px (optional) |
height | height of the window in px (optional) |
fg_color | forground color of the messagebox [middle portion] |
bg_color | background color of the messagebox |
title | title of the messagebox |
message | main message of the messagebox which will be shown at the center |
option_1 | the text on the first button [Default is 'OK'] |
option_2 | the text on the second button |
option_3 | the text on the last button |
button_color | color of the buttons |
text_color | color of the message-text |
title_color | color of the title-text |
button_text_color | color of the button-text |
button_width | width of the buttons in px |
cancel_button_color | color of the close button |
icon | icon that will be shown in the messagebox [Default is 'info'] |
icon_size | define the size of the icon image manually (tuple) |
corner_radius | corner roundness of the messagebox window [not applicable in linux] |
font | font of the messagebox text (tuple) |
Icons
Default icons:
(These icons are created by me using Paint.NET, free to use!)
For custom images, just use icon="path_to_the_image.png"
That's all, hope it will help in UI development!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
CTkMessagebox-1.2.tar.gz
(123.4 kB
view details)
Built Distribution
CTkMessagebox-1.2-py3-none-any.whl
(123.1 kB
view details)
File details
Details for the file CTkMessagebox-1.2.tar.gz
.
File metadata
- Download URL: CTkMessagebox-1.2.tar.gz
- Upload date:
- Size: 123.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7203787ce00d521e63f310682d81c3c65862b3948a8eca1a5d59716a6739790f |
|
MD5 | d4c320e137bebfaee329ae941a4a1f4c |
|
BLAKE2b-256 | 7826d740aeebcdb4665bd6fe96c6667c64e505f48a15a323cf34ca5435e33829 |
File details
Details for the file CTkMessagebox-1.2-py3-none-any.whl
.
File metadata
- Download URL: CTkMessagebox-1.2-py3-none-any.whl
- Upload date:
- Size: 123.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4d54b354ecc45716f68d03156ca62cbdb184e70435b1c6b79dbcd5cd55e6564 |
|
MD5 | 865b7f527b07ffe71584e74c01ff8aac |
|
BLAKE2b-256 | 4d4a0313645e4120c9792725a19972499463c2f705f3beb186e0ff7aeb6cf679 |