Skip to main content

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,其中界面效果支持最好的是Windows,MacOS 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值

  },
  ...
}

Metadata

Release files for customtkinterx 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for customtkinterx 0.4.4
File Size Uploaded Provenance
customtkinterx-0.4.4.tar.gz 105.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for customtkinterx 0.4.4
File Interpreter ABI Platform
customtkinterx-0.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 202.6 kB

Release files / customtkinterx-0.4.4.tar.gz

Download URL customtkinterx-0.4.4.tar.gz
Size 105.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d959ca8967f6db69a9c87b725cfb35dee42b05a46c7a0342e6611a6eea237645
BLAKE2b-256 checksum
How to use checksums
2e1f9d4e96872f5de658db3ea8553e0c4df3647da65ef5347345a7088da0662c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.2 Windows/10

Release files / customtkinterx-0.4.4-py3-none-any.whl

Download URL customtkinterx-0.4.4-py3-none-any.whl
Size 96.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d089b578583f40eaea08bf2efe632bc8e7f205c3eedddc28ec2e0de24c935e5
BLAKE2b-256 checksum
How to use checksums
5f9a67b4287a3fe66ba42a37b146baba34657c1ee457c482bf6354c6876a5064
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.2 Windows/10

Security for customtkinterx 0.4.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page