为 tkinter 提供常用字符串常量和增强功能
Project description
🧩 TkinterTabMore —— 为 Tkinter 提供常用常量和更多功能
✨ 简介 / Introduction
TkinterTabMore 是一个为 Python 的 tkinter 模块提供常用字符串常量和增强功能的辅助模块,旨在提升开发效率并减少拼写错误。
TkinterTabMore is a helper module that provides commonly used string constants and enhanced features for the Python tkinter module, aiming to improve development efficiency and reduce typos.
📦 安装 / Installation
pip install TkinterTabMore
📚 使用示例 / Usage Example
from tkinter import *
from TkinterTabMore import WM_DELETE_WINDOW, CURSOR_HAND, RELIEF_RAISED
root = Tk()
root.protocol(WM_DELETE_WINDOW, root.destroy)
btn = Button(root, text="点击 / Click", cursor=CURSOR_HAND, relief=RELIEF_RAISED)
btn.pack()
root.mainloop()
📄 第 2 段:窗口管理器协议 + 拖放支持(Xdnd)
📋 支持的常量列表 / Supported Constants
1. 🔧 窗口管理器协议 / Window Manager Protocols
WM_DELETE_WINDOW = "WM_DELETE_WINDOW"
窗口关闭协议 / Window close protocolWM_PROTOCOL_MESSAGE = "WM_PROTOCOL_MESSAGE"
窗口管理器通信消息 / Window manager communication message
2. 🖱️ 拖放支持(Xdnd) / Drag and Drop (Xdnd)
XdndEnter = "XdndEnter"
拖放进入窗口事件 / Drag enters the windowXdndPosition = "XdndPosition"
拖放位置更新事件 / Drag position update eventXdndDrop = "XdndDrop"
拖放释放事件 / Drop eventXdndStatus = "XdndStatus"
拖放状态反馈事件 / Drag status feedback eventXdndLeave = "XdndLeave"
拖放离开窗口事件 / Drag leaves the windowXdndFinished = "XdndFinished"
拖放结束事件 / Drag finished eventXdndSelection = "XdndSelection"
拖放数据请求事件 / Drag data request eventXdndActionCopy = "XdndActionCopy"
拖放复制操作 / Copy action in drag and dropXdndActionMove = "XdndActionMove"
拖放移动操作 / Move action in drag and dropXdndActionLink = "XdndActionLink"
拖放链接操作 / Link action in drag and dropXdndActionAsk = "XdndActionAsk"
拖放询问用户操作 / Ask user action in drag and drop
3. 📋 剪贴板 / Clipboard
CLIPBOARD = "CLIPBOARD"
系统剪贴板名称 / System clipboard namePRIMARY = "PRIMARY"
主选剪贴板名称(X11) / Primary selection clipboard (X11)TARGETS = "TARGETS"
剪贴板数据类型列表 / Clipboard data type list
4. 🎯 虚拟事件 / Virtual Events
VIRTUAL_EVENT_PREFIX = "<<"
虚拟事件前缀 / Prefix for virtual eventsVIRTUAL_EVENT_SUFFIX = ">>"
虚拟事件后缀 / Suffix for virtual events
5. 📦 Tk 版本 / Tk Versions
TK_VERSION = "tk_version"
Tk 当前版本号字符串 / Current Tk version stringTK_PATCHLEVEL = "tk_patchLevel"
Tk 补丁级别 / Tk patch level
6. 📁 文件类型 / File Types
FILE_TYPES_ALL = "*.*"
所有文件类型 / All file typesFILE_TYPES_TEXT = "*.txt"
文本文件 / Text file type (*.txt)FILE_TYPES_PYTHON = "*.py"
Python 源代码文件 / Python source files (*.py)FILE_TYPES_IMAGE = "*.png *.jpg *.jpeg *.gif *.bmp"
图像文件 / Image files (*.png, *.jpg, etc.)FILE_TYPES_JSON = "*.json"
JSON 数据文件 / JSON data files (*.json)FILE_TYPES_CSV = "*.csv"
CSV 表格文件 / CSV table files (*.csv)
7. 🖱️ 鼠标光标 / Mouse Cursors
CURSOR_ARROW = "arrow"
箭头光标 / Arrow cursorCURSOR_HAND = "hand2"
手型光标 / Hand cursorCURSOR_XTERM = "xterm"
文本输入光标 / Text input cursorCURSOR_CROSSHAIR = "crosshair"
十字光标 / Crosshair cursorCURSOR_WAIT = "watch"
等待光标 / Wait cursorCURSOR_SIZE_NW_SE = "size_nw_se"
西北-东南调整光标 / NW-SE resize cursorCURSOR_SIZE_NE_SW = "size_ne_sw"
东北-西南调整光标 / NE-SW resize cursorCURSOR_SIZE_HOR = "sb_h_double_arrow"
水平调整光标 / Horizontal resize cursorCURSOR_SIZE_VER = "sb_v_double_arrow"
垂直调整光标 / Vertical resize cursor
8. ⚙️ 控件状态 / Widget States
STATE_NORMAL = "normal"
控件可用状态 / Widget is enabled and interactiveSTATE_DISABLED = "disabled"
控件禁用状态 / Widget is disabledSTATE_READONLY = "readonly"
控件只读状态 / Widget is read-only
9. 🧭 锚点位置 / Anchor Positions
ANCHOR_CENTER = "center"
居中对齐 / Center alignmentANCHOR_N = "n"
北对齐(上) / North (top) alignmentANCHOR_S = "s"
南对齐(下) / South (bottom) alignmentANCHOR_E = "e"
东对齐(右) / East (right) alignmentANCHOR_W = "w"
西对齐(左) / West (left) alignmentANCHOR_NE = "ne"
东北对齐 / Northeast alignmentANCHOR_NW = "nw"
西北对齐 / Northwest alignmentANCHOR_SE = "se"
东南对齐 / Southeast alignmentANCHOR_SW = "sw"
西南对齐 / Southwest alignment
10. 📐 布局扩展 / Layout Expand Options
EXPAND_BOTH = "both"
同时扩展 / Expand both horizontally and verticallyEXPAND_X = "x"
横向扩展 / Expand horizontallyEXPAND_Y = "y"
纵向扩展 / Expand vertically
11. 📦 填充方向 / Fill Options
FILL_X = "x"
横向填充 / Fill horizontallyFILL_Y = "y"
纵向填充 / Fill verticallyFILL_BOTH = "both"
横纵填充 / Fill both directionsFILL_NONE = "none"
不填充 / No fill
12. 🧱 排列方向 / Layout Side Options
SIDE_TOP = "top"
顶部排列 / Pack to the topSIDE_BOTTOM = "bottom"
底部排列 / Pack to the bottomSIDE_LEFT = "left"
左侧排列 / Pack to the leftSIDE_RIGHT = "right"
右侧排列 / Pack to the right
13. 📐 对齐方式 / Justify Options
JUSTIFY_LEFT = "left"
左对齐 / Left justifyJUSTIFY_CENTER = "center"
居中对齐 / Center justifyJUSTIFY_RIGHT = "right"
右对齐 / Right justify
14. 🧱 边框样式 / Relief Styles
RELIEF_RAISED = "raised"
凸起边框样式 / Raised relief styleRELIEF_SUNKEN = "sunken"
凹陷边框样式 / Sunken relief styleRELIEF_FLAT = "flat"
平直边框样式 / Flat relief styleRELIEF_GROOVE = "groove"
沟槽边框样式 / Groove relief styleRELIEF_RIDGE = "ridge"
山脊边框样式 / Ridge relief styleRELIEF_SOLID = "solid"
实线边框样式 / Solid relief style
15. 🔤 其他常用值 / Other Useful Constants
YES = "yes"
Tkinter 中的“是”值 / 'yes' in layout optionsNO = "no"
Tkinter 中的“否”值 / 'no' in layout optionsTRUE = "1"
Tkinter 中的“真”值 / '1' as TrueFALSE = "0"
Tkinter 中的“假”值 / '0' as FalseDEFAULT = "default"
Tkinter 中默认选项 / Default option
🙌 感谢使用 / Thanks for Using
感谢你使用 TkinterTabMore!如果你有任何建议或问题,欢迎提交 issue 或 PR。
Thanks for using TkinterTabMore! If you have any suggestions or issues, feel free to open an issue or pull request.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tkintertabmore-0.0.1.tar.gz.
File metadata
- Download URL: tkintertabmore-0.0.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e569e1f791f6d02059598e6645c1f5f3286ed28e057eed3581e6d32aaf47e51
|
|
| MD5 |
785a86ca4d2113f2208e461500c94bfa
|
|
| BLAKE2b-256 |
9842192d7c27e10465129906d92df7d7d62801be476461812b504963471c5207
|
File details
Details for the file tkintertabmore-0.0.1-py3-none-any.whl.
File metadata
- Download URL: tkintertabmore-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5c0eb09fe17de926a3a199739adc80301896da15c6e026e9d5e67b97d41363e
|
|
| MD5 |
d121531928ceab2f7d01f8beb65eb71d
|
|
| BLAKE2b-256 |
ed2003d43dd8e0ab8d6a716d00bff6c7ec2747762944ad5a56f9ad15d61e10a7
|