README.md 7.4 KB
Newer Older
小康2022's avatar
小康2022 已提交
1
<div align="center">
小康2022 已提交
2 3 4 5 6 7 8 9

# 🚀tkintertools🚀

<img src="tkt.png" style="height: 128px" alt="Logo" />

`tkintertools` 模块是 `tkinter` 模块的一个辅助模块\
The `tkintertools` module is an auxiliary module of the `tkinter` module

小康2022 已提交
10 11
[![Version](https://img.shields.io/pypi/v/tkintertools?label=Version)](.)
[![License](https://img.shields.io/pypi/l/tkintertools?label=License)](LICENSE.txt)
小康2022 已提交
12
[![ChangeLog](https://img.shields.io/badge/ChangeLog-2023/06/17-orange)](CHANGELOG.md)
小康2022 已提交
13 14
[![ToDo](https://img.shields.io/badge/ToDo-14-yellow)](TODO.md)
[![Size](https://img.shields.io/github/languages/code-size/Xiaokang2022/tkintertools?label=Size)](tkintertools)
小康2022 已提交
15
[![Wiki](https://img.shields.io/badge/Wiki-15-purple)](https://github.com/Xiaokang2022/tkintertools/wiki)\
小康2022 已提交
16 17
[![Downloads](https://img.shields.io/pypi/dm/tkintertools?label=Downloads&logo=pypi)](https://pypistats.org/packages/tkintertools)
[![Owner](https://img.shields.io/badge/Owner-Xiaokang2022-white)](https://github.com/Xiaokang2022)
小康2022 已提交
18 19 20 21 22
[![Blog](https://img.shields.io/badge/Blog-小康2022@CSDN-red)](https://xiaokang2022.blog.csdn.net)
[![Email](https://img.shields.io/badge/Email-2951256653@qq.com-cyan)](mailto:2951256653@qq.com)

[![Insights](https://repobeats.axiom.co/api/embed/ab8fae686a5a96f91fa71c40c53c189310924f5e.svg)](https://github.com/Xiaokang2022/tkintertools/pulse)

小康2022's avatar
小康2022 已提交
23 24
</div>

小康2022 已提交
25 26 27 28
Install/模块安装👇
-----------------

### Stable Version/稳定版本
小康2022's avatar
小康2022 已提交
29

小康2022 已提交
30 31
* Version/最新版本 : `2.6.5`
* Release/发布日期 : 2023/06/17 (UTC+08)
小康2022's avatar
小康2022 已提交
32

小康2022 已提交
33 34
这个是目前的最新稳定版,相对于开发版本而言比较稳定,bug 大体上是没有那么多的,推荐使用这个。  
稳定版和开发版相比,它在发布之前有个测试的步骤,经过测试之后(各项功能正常运行,多平台兼容)才会发布。
小康2022's avatar
小康2022 已提交
35

小康2022 已提交
36
**PIP Cmd/安装命令:**
小康2022's avatar
小康2022 已提交
37

小康2022 已提交
38
```
小康2022 已提交
39
pip install tkintertools==2.6.5
小康2022 已提交
40 41
```

小康2022 已提交
42
### Development Version/开发版本
小康2022's avatar
小康2022 已提交
43

小康2022 已提交
44 45
* Version/最新版本 : `2.6.5`
* Release/发布日期 : 2023/06/13 (UTC+08)
小康2022's avatar
小康2022 已提交
46

小康2022 已提交
47
这个是我正在开发的版本,可能有新功能,bug 可能会比较多,但也可能会比原来的版本更加稳定。  
小康2022 已提交
48 49
开发版没有经过多操作系统的测试,仅能保证在 Windows 系统下运行所有功能,在其他的操作系统上,可能有部分功能无法正常运行。  
大家可以在 Issues 中提出一些建议,我可能会适当采纳一些并在开发版本中更改或实现。
小康2022 已提交
50

小康2022 已提交
51 52
**PIP Cmd/安装命令:**

小康2022's avatar
小康2022 已提交
53
```
小康2022 已提交
54
pip install tkintertools-dev==2.6.5
小康2022's avatar
小康2022 已提交
55 56
```

小康2022 已提交
57 58 59
> **Warning**  
> 开发版仅作示例,各函数或类的 API 并非最终确定结果,直接使用开发版可能导致后续无法与稳定版兼容!  
> 若要使用开发版,请先卸载稳定版后再进行 pip 安装,再次使用稳定版时也是一样,先卸载开发版再安装稳定版,否则会导致安装无效!
小康2022 已提交
60

小康2022 已提交
61
### Requirements/环境需求
小康2022 已提交
62

小康2022 已提交
63 64 65 66 67 68 69 70
目前稳定版在以下操作系统中已经测试通过:

![Windows10](https://img.shields.io/badge/Windows-10-green?logo=windows)
![Windows11](https://img.shields.io/badge/Windows-11-green?logo=windows11)
![Ubuntu22.04](https://img.shields.io/badge/Ubuntu-22.04-green?logo=ubuntu)

可能还有其他的操作系统也是可以运行 tkintertools 的,我没有进行更多的验证。  
没有任何额外的依赖包(除了一般 Python 内置的 tkinter),但只支持以下 Python 版本:
小康2022 已提交
71 72 73 74 75 76 77

![Python3.8](https://img.shields.io/badge/Python-3.8.*-blue?logo=python)
![Python3.9](https://img.shields.io/badge/Python-3.9.*-blue?logo=python)
![Python3.10](https://img.shields.io/badge/Python-3.10.*-blue?logo=python)
![Python3.11](https://img.shields.io/badge/Python-3.11.*-blue?logo=python)
![Python3.12](https://img.shields.io/badge/Python-3.12.*-blue?logo=python)

小康2022 已提交
78 79
News/最新功能👇
--------------
小康2022 已提交
80

小康2022 已提交
81 82
**最新版本: tkintertools-2.6.5 稳定版**

小康2022 已提交
83 84 85
> **Note**  
> 重磅炸裂更新:新增了 Wiki 供大家查看,方便大家迅速掌握 tkintertools 的使用方法和小技巧![点此传送](https://github.com/Xiaokang2022/tkintertools/wiki)  
> 近期本人将暂时停止对 tkintertools 模块本身的更新,本人先去完善 Wiki 再继续更新 tkintertools!
小康2022 已提交
86

小康2022 已提交
87
下面是本次版本更新内容条目:
小康2022 已提交
88

小康2022 已提交
89 90 91 92 93
- [X] 子模块 `tools_3d` 新增类 `Space` 可以直接提供对 3D 对象进行平移、旋转和缩放等操作的功能;
- [X] 修复了类 `Cuboid` 和类 `Tetrahedron` 没有将实例添加到父类 `Canvas_3D` 的 bug;
- [X] 修复了当 3D 对象出现在相机位置后面时会显示错误的 bug(目前更改为透视,即不显示);
- [X] 修复了部分错误的类型提示和错误的参数默认值;
- [X] 移除常量 `BACKGROUND` 并且不再对类 `Canvas` 的默认背景颜色做限定;
小康2022 已提交
94

小康2022 已提交
95
下面是一个主要新功能的示例程序,运行下面的示例程序时,其拥有以下功能:
小康2022 已提交
96

小康2022 已提交
97 98
* 按住鼠标左键拖动可以旋转这多个几何体;
* 按住鼠标右键拖动可以移动这些几何体在空间中的位置;
小康2022 已提交
99
* 滚动鼠标中键可以放大和缩小画面;
小康2022 已提交
100
* 按“=”和“-”键分别可以放大和缩小几何体的大小;
小康2022 已提交
101

小康2022 已提交
102
下面是示例程序的效果图(运行环境为 Windows11-Python3.11.4):
小康2022 已提交
103

小康2022 已提交
104
![news.png](news.png)
小康2022 已提交
105

小康2022 已提交
106
<details><summary><b>点击查看源代码</b></summary>
小康2022 已提交
107 108 109 110 111

```python
import tkintertools as tkt
from tkintertools import tools_3d as t3d

小康2022 已提交
112 113
root = tkt.Tk('tkintertools-2.6.5', 1280, 720)
cv3d = t3d.Space(root, 1280, 720, 0, 0)
小康2022 已提交
114

小康2022 已提交
115 116 117 118 119 120
for a in -100, 0, 100:
    for b in -100, 0, 100:
        for c in -100, 0, 100:
            t3d.Cuboid(cv3d, a-50, b-50, c-50, 100, 100, 100,
                       color_up='white', color_down='yellow', color_left='red',
                       color_right='orange', color_front='blue', color_back='green')
小康2022 已提交
121
cv3d.space_sort()
小康2022 已提交
122 123


小康2022 已提交
124
def scale(event):
小康2022 已提交
125
    """ 缩放事件 """
小康2022 已提交
126
    k = 1.05 if event.keysym == 'equal' else 0.95 if event.keysym == 'minus' else 1
小康2022 已提交
127
    for geo in cv3d.geos():
小康2022 已提交
128 129
        geo.scale(k, k, k)
        geo.update()
小康2022 已提交
130 131 132 133
    cv3d.space_sort()


root.bind('<Any-Key>', scale)
小康2022 已提交
134 135 136 137 138
root.mainloop()
```

</details>

小康2022 已提交
139 140
More/更多👇
-----------
小康2022 已提交
141

小康2022 已提交
142 143 144 145 146 147 148 149 150
[![GitHub](https://img.shields.io/badge/GitHub-仓库根源%20完整无误%20以此为准-blue?logo=github)](https://github.com/Xiaokang2022/tkintertools)
[![Gitee](https://img.shields.io/badge/Gitee-主镜像源%20比较完整%20可能延迟-green?logo=gitee)](https://gitee.com/xiaokang-2022/tkintertools)
[![GitCode](https://img.shields.io/badge/GitCode-次镜像源%20缺少Wiki%20CSDN-yellow)](https://gitcode.net/weixin_62651706/tkintertools)\
[![GitHub Watchers](https://img.shields.io/github/watchers/Xiaokang2022/tkintertools?label=GitHub%20Watchers&color=green)](https://github.com/Xiaokang2022/tkintertools/watchers)
[![GitHub Forks](https://img.shields.io/github/forks/Xiaokang2022/tkintertools?label=GitHub%20Forks)](https://github.com/Xiaokang2022/tkintertools/forks)
[![GitHub Stars](https://img.shields.io/github/stars/Xiaokang2022/tkintertools?label=GitHub%20Stars&color=gold)](https://github.com/Xiaokang2022/tkintertools/stargazers)
[![GitHub Contributors](https://img.shields.io/github/contributors/Xiaokang2022/tkintertools?label=GitHub%20Contributors)](https://github.com/Xiaokang2022/tkintertools/graphs/contributors)
[![GitHub Issues](https://img.shields.io/github/issues/Xiaokang2022/tkintertools?label=GitHub%20Issues)](https://github.com/Xiaokang2022/tkintertools/issues)
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/Xiaokang2022/tkintertools?label=GitHub%20Pull%20Requests)](https://github.com/Xiaokang2022/tkintertools/pulls)