Skip to main content

extra widgets for customtkinter

Project description

CustomTkinterX

解释器需Python3.7及以上

customtkinter的扩展组件功能库,同时也采集了其他开发者制作的组件,并进行仅类型提示上的修改(源代码__main__.py上有标注)

Fluent主题

尚未完善设置,修改了CTk CTkToplevel CTkFrame CTkButton CTKEntry CTkComboBox等类。

from customtkinter import *
from customtkinterx import *

CTkFluentTheme()

CTkCustom 自定义窗口

原窗口因标题栏与边框的限制,导致界面效果极差,但是仍可以通过一些方法自定义窗口wm_overrideredirect。 平台支持Windows MacOS Linux,其中界面效果支持最好的是WindowsMacOS Linux无法使用透明色,完全消除边框使用圆角, 及将图标保留至任务栏,采用置顶的方法保持窗口的显示。

组件结构

| CTkCustom -> CTk
|-->> __frame_border(mainframe): CTkFrame
|-->> __frame_title(titlebar): CTkFrame
|-->> __label_title(titlebar_title): CTkLabel
|-->> __button_close(titlebar_closebutton): CTkButton
|-->> __button_minimize(titlebar_minimizebutton): CTkButton

基础示例

from customtkinter import *
from customtkinterx import *

root = CTkCustom()

root.mainloop()

主题配置

你可以自定义一个主题,然后加上CTkCustom

{
  ...
    "transparent_color": "#101010", // 为实现圆角边框而设置的透明色

    "closebutton_text_color": ["#000000", "#ffffff"],
    "closebutton_color": ["#f4f6f8", "#212b36"],
    "closebutton_hover_color": ["#b40d1b", "#b40d1b"],

    "minimizebutton_text_color": ["#000000", "#ffffff"],
    "minimizebutton_color": ["#f4f6f8", "#212b36"],
    "minimizebutton_hover_color": ["#dfe3e8", "#454f5b"]
  },
  ...
}

添加缩放窗口大小的手柄

CTKCustom.create_sizegrip()

自定义手柄,将会使用库pyautogui

python -m pip install pyautogui
CTKCustom.create_sizegrip(True)
from customtkinter import *
from customtkinterx import *

root = CTkCustom()
root.create_sizegrip()

root.mainloop()
from customtkinter import *
from customtkinterx import *

root = CTkCustom()
root.create_sizegrip(True)

root.mainloop()

CTkInfoBar 消息栏

组件结构

| CTkInforBar -> CTkFrame
|-->> __label_title(title): CTkLabel
|-->> __label_info(info): CTkLabel
|-->> __button_close(close): CTkButton

基础示例

from customtkinter import *
from customtkinterx import *

root = CTk()

infobar = CTkInfoBar()
infobar.show()

root.mainloop()

主题配置

你可以自定义一个主题,然后加上CTkInfoBar

{
  ...
  "CTkInfoBar": {
    "corner_radius": 8,
    "border_width": 0,

    "fg_color": ["#61f3f3", "#006c9c"], 
    "fg_hover_color": ["#cafdf5", "#003768"], // 关闭按钮被鼠标捕捉时的颜色

    "border_color": ["#b0b2b2", "#424556"],  

    "success_color": ["#86e8ab", "#1b806a"],  // 取自配色severity中NORMAL值
    "success_hover_color": ["#d8fbde", "#0a5554"],  // 取自配色severity中被鼠标捕捉时的NORMAL值
    "caution_color": ["#ffd666", "#b76e00"],  // 取自配色severity中CAUTION值
    "caution_hover_color": ["#fff5cc", "#7a4100"],  // 取自配色severity中被鼠标捕捉时的CAUTION值
    "critical_color": ["#ffac82", "#b71d18"],  // 取自配色severity中CRITICAL值
    "critical_hover_color": ["#ffe9d5", "#7a0916"]  // 取自配色severity中被鼠标捕捉时的CAUTION值

  },
  ...
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

customtkinterx-0.4.4.tar.gz (105.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

customtkinterx-0.4.4-py3-none-any.whl (96.9 kB view details)

Uploaded Python 3

File details

Details for the file customtkinterx-0.4.4.tar.gz.

File metadata

  • Download URL: customtkinterx-0.4.4.tar.gz
  • Upload date:
  • Size: 105.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.2 Windows/10

File hashes

Hashes for customtkinterx-0.4.4.tar.gz
Algorithm Hash digest
SHA256 d959ca8967f6db69a9c87b725cfb35dee42b05a46c7a0342e6611a6eea237645
MD5 b8d4e639e0fcee3a4af47fcbf39d3a9a
BLAKE2b-256 2e1f9d4e96872f5de658db3ea8553e0c4df3647da65ef5347345a7088da0662c

See more details on using hashes here.

File details

Details for the file customtkinterx-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: customtkinterx-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 96.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.2 Windows/10

File hashes

Hashes for customtkinterx-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9d089b578583f40eaea08bf2efe632bc8e7f205c3eedddc28ec2e0de24c935e5
MD5 d2180dc780cb5a7ff6f48ee01dec4568
BLAKE2b-256 5f9a67b4287a3fe66ba42a37b146baba34657c1ee457c482bf6354c6876a5064

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page