GithubHelp home page GithubHelp logo

cnov20 / customtkinter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tomschimansky/customtkinter

0.0 0.0 0.0 143.48 MB

A modern and customizable python UI-library based on Tkinter

License: Creative Commons Zero v1.0 Universal

Python 100.00%

customtkinter's Introduction

PyPI PyPI - Downloads PyPI - License Total lines

CustomTkinter UI-Library

| complex_example.py on Windows 11 with dark mode and 'dark-blue' theme

| complex_example.py on macOS in light mode and standard 'blue' theme

CustomTkinter is a python UI-library based on Tkinter, which provides new, modern and fully customizable widgets. They are created and used like normal Tkinter widgets and can also be used in combination with normal Tkinter elements. The widgets and the window colors either adapt to the system appearance or the manually set mode ('light', 'dark'), and all CustomTkinter widgets and windows support HighDPI scaling (Windows, macOS). With CustomTkinter you'll get a consistent and modern look across all desktop platforms (Windows, macOS, Linux).

Installation

Install the module with pip:

pip3 install customtkinter

Update existing installation: pip3 install customtkinter --upgrade
(update as often as possible because this library is under active development)

Documentation

The official documentation can be found in the Wiki Tab here:

--> Documentation.

Example Program

To test customtkinter you can try this simple example with only a single button:

import customtkinter

customtkinter.set_appearance_mode("System")  # Modes: system (default), light, dark
customtkinter.set_default_color_theme("blue")  # Themes: blue (default), dark-blue, green

app = customtkinter.CTk()  # create CTk window like you do with the Tk window
app.geometry("400x240")

def button_function():
    print("button pressed")

# Use CTkButton instead of tkinter Button
button = customtkinter.CTkButton(master=app, text="CTkButton", command=button_function)
button.place(relx=0.5, rely=0.5, anchor=customtkinter.CENTER)

app.mainloop()

which gives the following (macOS dark mode on):

In the examples folder, you can find more example programs and in the Documentation you can find further information on the appearance mode, the themes and all widgets.

More Examples and Showcase

Appearance mode change

On Windows 10/11 you get a dark window header, which changes with set appearance mode or the system, when you use customtkinter.CTk() to create the window, and it works with all python versions:

| complex_example.py on Windows 11 with system mode change and standard 'blue' theme

On macOS however you either need python3.10 or higher or the anaconda python version to get a dark window header at all (Tcl/Tk >= 8.6.9 required).

| complex_example.py on macOS with system mode change and standard 'blue' theme

Button with images

It's possible to put an image on a CTkButton. You just have to pass a PhotoImage object to the CTkButton with the image argument. If you want no text at all you have to set text="" or you specify how to position the text and image at once with the compound option:

| example_button_images.py on macOS

Integration of TkinterMapView widget

In the following example I used a TkinterMapView which integrates well with a CustomTkinter program. It's a tile based map widget which displays OpenStreetMap or other tile based maps:

| examples/map_with_customtkinter.py from TkinterMapView repository on macOS

You can find the TkinterMapView library and the example program here: https://github.com/TomSchimansky/TkinterMapView

customtkinter's People

Contributors

tomschimansky avatar anandsshah avatar felipetesc avatar mohsen1365ir avatar ripeey avatar bengy3d avatar o0morgan0o avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.