提交 7ba50853 编写于 作者: 小康2022

version 2.6.6.dev0

上级 1b1133ff
ChangeLog/更新日志
=================
[`2.6.6.dev0`] - 2023-06-29
---------------------------
### Features/新增
- [X] Added abstract class `_3D_Object` as the metabase class for classes `_Point`, `_Line`, and `_Side`
新增抽象类 `_3D_Object` 来作为类 `_Point``_Line``_Side` 的元基类
### Optimized/优化
- [X] Optimized parameter passing in 3D submodules, users do not need to ensure the transitivity of `list` at all times, and parameters that used to only use the `list` type are now `Iterable` type
优化了 3D 子模块中的参数传递,使用者不需要时刻保证 `list` 的传递性,且原来只能使用 `list` 类型的参数现在为 `Iterable` 类型
- [X] The way 3D objects are centered in the 3D submodule has changed, which has improved performance and reduced the amount of code
3D 子模块中 3D 对象居中方式改变,相比原来性能提升了不少,代码量也减少了
- [X] Corrected some incorrect type hints and improved some missing method comments
改正了部分错误的类型提示,完善了部分缺少的方法注释
- [X] In the 3D submodule, the distance between two points was originally calculated with the function `hypot`, and now the function `dist` is used directly to calculate the Euclidean distance between two points to improve performance
3D 子模块中原来用函数 `hypot` 计算两点间距离,现在直接用函数 `dist` 计算两点间欧几里得距离,提高性能
- [X] The position display of controls of class `Point` has been optimized in the 3D submodule so that it is always at the forefront
3D 子模块中优化了类 `Point` 的控件位置显示,让其始终保持在最前
### Changed/变更
- [X] The parameters `point1` and `point2` of class `Point` of the 3D submodule and its parent class `_Point` were renamed to `point_start` and `point_end` respectively
3D 子模块的类 `Point` 及其父类 `_Point` 的参数 `point1``point2` 分别被重命名为 `point_start``point_end`
- [X] The parameter `origin_color` of the class `Space` of the 3D submodule has been changed to four new parameters, namely `origin_size`, `origin_width`, `origin_fill` and `origin_outline`
3D 子模块的类 `Space` 的参数 `origin_color` 被更改为四个新的参数,分别是 `origin_size``origin_width``origin_fill``origin_outline`
### Removed/移除
- [X] The classes `Canvas_3D` and `Space` of the 3D submodule remove the parameters `dx` and `dy`, and the default field of view of the canvas remains centered, i.e. their center is now the original upper-left vertex
3D 子模块的类 `Canvas_3D``Space` 移除参数 `dx``dy`,画布默认视野保持居中,也就是说,现在它们的中心位置才是原来的左上角顶点
[`2.6.5`] - 2023-06-17
----------------------
......@@ -423,8 +461,8 @@ ChangeLog/更新日志
- [X] Solved the bug that the `destroy` method of the control can only delete half of the controls when traversing
解决了控件的 `destroy` 方法在遍历使用时只能删除一半控件的 bug
Thanks to [-ShuiGuang-](https://blog.csdn.net/atlantis618) for finding the above bug
感谢 [-ShuiGuang-](https://blog.csdn.net/atlantis618) 发现了上面的 bug
> Thanks to [-ShuiGuang-](https://blog.csdn.net/atlantis618) for finding the above bug
感谢 [-ShuiGuang-](https://blog.csdn.net/atlantis618) 发现了上面的 bug
### Optimized/优化
......
......@@ -9,12 +9,12 @@ The `tkintertools` module is an auxiliary module of the `tkinter` module
[![Version](https://img.shields.io/pypi/v/tkintertools?label=Version)](.)
[![License](https://img.shields.io/pypi/l/tkintertools?label=License)](LICENSE.txt)
[![ChangeLog](https://img.shields.io/badge/ChangeLog-2023/06/17-orange)](CHANGELOG.md)
[![ToDo](https://img.shields.io/badge/ToDo-14-yellow)](TODO.md)
[![ChangeLog](https://img.shields.io/badge/ChangeLog-2023/06/29-orange)](CHANGELOG.md)
[![ToDo](https://img.shields.io/badge/ToDo-16-yellow)](TODO.md)
[![Size](https://img.shields.io/github/languages/code-size/Xiaokang2022/tkintertools?label=Size)](tkintertools)
[![Wiki](https://img.shields.io/badge/Wiki-15-purple)](https://github.com/Xiaokang2022/tkintertools/wiki)\
[![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)
[![Owner](https://img.shields.io/badge/Owner-Xiaokang2022-white?logo=about.me)](https://github.com/Xiaokang2022)
[![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)
......@@ -41,8 +41,8 @@ pip install tkintertools==2.6.5
### Development Version/开发版本
* Version/最新版本 : `2.6.5`
* Release/发布日期 : 2023/06/13 (UTC+08)
* Version/最新版本 : `2.6.6.dev0`
* Release/发布日期 : 2023/06/29 (UTC+08)
这个是我正在开发的版本,可能有新功能,bug 可能会比较多,但也可能会比原来的版本更加稳定。
开发版没有经过多操作系统的测试,仅能保证在 Windows 系统下运行所有功能,在其他的操作系统上,可能有部分功能无法正常运行。
......@@ -51,12 +51,12 @@ pip install tkintertools==2.6.5
**PIP Cmd/安装命令:**
```
pip install tkintertools-dev==2.6.5
pip install tkintertools==2.6.6.dev0
```
> **Warning**
> 开发版仅作示例,各函数或类的 API 并非最终确定结果,直接使用开发版可能导致后续无法与稳定版兼容!
> 若要使用开发版,请先卸载稳定版后再进行 pip 安装,再次使用稳定版时也是一样,先卸载开发版再安装稳定版,否则会导致安装无效
> 若不指定具体的版本号,则会下载最新的稳定版本,也就是说,开发版本只能通过指定的版本号获取
### Requirements/环境需求
......@@ -69,69 +69,68 @@ pip install tkintertools-dev==2.6.5
可能还有其他的操作系统也是可以运行 tkintertools 的,我没有进行更多的验证。
没有任何额外的依赖包(除了一般 Python 内置的 tkinter),但只支持以下 Python 版本:
![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)
![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)
News/最新功能👇
--------------
**最新版本: tkintertools-2.6.5 稳定版**
**最新版本: tkintertools-v2.6.6.dev0**
> **Note**
> 重磅炸裂更新:新增了 Wiki 供大家查看,方便大家迅速掌握 tkintertools 的使用方法和小技巧![点此传送](https://github.com/Xiaokang2022/tkintertools/wiki)
> 近期本人将暂时停止对 tkintertools 模块本身的更新,本人先去完善 Wiki 再继续更新 tkintertools!
> 现将开发版(`tkintertools-dev`)合并到稳定版(`tkintertools`)中,版本号格式变为 `*.*.*.dev*`,大家在通过 pip 工具进行下载时请注意!近段时间内将删除 PyPi 上的 tkintertools-dev!
下面是本次版本更新内容条目:
- [X] 子模块 `tools_3d` 新增类 `Space` 可以直接提供对 3D 对象进行平移、旋转和缩放等操作的功能;
- [X] 修复了类 `Cuboid` 和类 `Tetrahedron` 没有将实例添加到父类 `Canvas_3D` 的 bug;
- [X] 修复了当 3D 对象出现在相机位置后面时会显示错误的 bug(目前更改为透视,即不显示);
- [X] 修复了部分错误的类型提示和错误的参数默认值;
- [X] 移除常量 `BACKGROUND` 并且不再对类 `Canvas` 的默认背景颜色做限定;
- [X] 新增抽象类 `_3D_Object` 来作为类 `_Point``_Line``_Side` 的元基类;
- [X] 优化了 3D 子模块中的参数传递,使用者不需要时刻保证 `list` 的传递性,且原来只能使用 `list` 类型的参数现在为 `Iterable` 类型;
- [X] 3D 子模块中 3D 对象居中方式改变,相比原来性能提升了不少,代码量也减少了;
- [X] 改正了部分错误的类型提示,完善了部分缺少的方法注释;
- [X] 3D 子模块中原来用函数 `hypot` 计算两点间距离,现在直接用函数 `dist` 计算两点间欧几里得距离,提高性能;
- [X] 3D 子模块中优化了类 `Point` 的控件位置显示,让其始终保持在最前;
- [X] 3D 子模块的类 `Point` 及其父类 `_Point` 的参数 `point1``point2` 分别被重命名为 `point_start``point_end`
- [X] 3D 子模块的类 `Space` 的参数 `origin_color` 被更改为四个新的参数,分别是 `origin_size``origin_width``origin_fill``origin_outline`
- [X] 3D 子模块的类 `Canvas_3D``Space` 移除参数 `dx``dy`,画布默认视野保持居中,也就是说,现在它们的中心位置才是原来的左上角顶点;
下面是一个主要新功能的示例程序,运行下面的示例程序时,其拥有以下功能:
* 按住鼠标左键拖动可以旋转这多个几何体;
* 按住鼠标右键拖动可以移动这些几何体在空间中的位置;
* 滚动鼠标中键可以放大和缩小画面;
* 按“=”和“-”键分别可以放大和缩小几何体的大小;
下面是示例程序的效果图(运行环境为 Windows11-Python3.11.4):
![news.png](news.png)
![news](news.png)
<details><summary><b>点击查看源代码</b></summary>
```python
import tkintertools as tkt
from tkintertools import tools_3d as t3d
root = tkt.Tk('tkintertools-2.6.5', 1280, 720)
cv3d = t3d.Space(root, 1280, 720, 0, 0)
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')
cv3d.space_sort()
def scale(event):
""" 缩放事件 """
k = 1.05 if event.keysym == 'equal' else 0.95 if event.keysym == 'minus' else 1
for geo in cv3d.geos():
geo.scale(k, k, k)
geo.update()
cv3d.space_sort()
root.bind('<Any-Key>', scale)
root.mainloop()
import math # 数学支持
import tkintertools as tkt # 引入基础模块
from tkintertools import tools_3d as t3d # 引入 3d 子模块
root = tkt.Tk('3D', 1280, 720) # 创建窗口
space = t3d.Space(root, 1280, 720, 0, 0) # 创建空间
last_point = [0, 100*math.cos(-math.pi/3), 100*math.sin(-math.pi/3)]
color_lst = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
color_lst += color_lst
for i in range(6):
rad = i*math.pi/3
next_point = [0, 100*math.cos(rad), 100*math.sin(rad)]
point_h2 = [0, 150*math.cos(rad), 150*math.sin(rad)]
t3d.Line(space, last_point, next_point, width=3, fill=color_lst[i])
t3d.Line(space, next_point, point_h2, width=3, fill=color_lst[i+1])
t3d.Point(space, last_point, size=20, fill=color_lst[i+2])
t3d.Point(space, point_h2, size=10, fill=color_lst[i+3])
last_point = next_point
space.space_sort() # 给它们的空间位置排序以正确显示
root.mainloop() # 消息事件循环
```
</details>
......
......@@ -18,6 +18,9 @@ TODO/待办
5. [ ] The position relationship between the space before and after the 3D object is still problematic at some point
3D 对象前后空间的位置关系在某些时候仍有问题
6. [ ] When creating a 3D object of concave geometry, calling its `scale` method displays an error
创建凹面几何体的 3D 对象时,调用其 `scale` 方法会显示错误
### Features/期望功能
1. [ ] Perfect the scroll bar function of `Text` class
......@@ -46,3 +49,6 @@ TODO/待办
9. [ ] Add more 3D spatial geometry classes
增加更多 3D 空间几何体类
10. [ ] Add lights and achieve simple light and shadow renderings
添加光源,并实现简单的光影渲染的效果
news.png

34.4 KB | W: | H:

news.png

15.0 KB | W: | H:

news.png
news.png
news.png
news.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -128,7 +128,7 @@ class Application:
def canvas_3d_init(self):
tkt.Button(
self.canvas_3d, 10, 660, 200, 50, text='Back',
self.canvas_3d, 10-640, 660-360, 200, 50, text='Back',
command=lambda: (tkt.move(self.root, self.canvas_graph, 1280*self.canvas_main.rx, 0, 500, mode='rebound'),
tkt.move(self.root, self.canvas_3d, 1280*self.canvas_graph.rx, 0, 500, mode='rebound')))
......
......@@ -50,7 +50,7 @@ from .__main__ import (Button, Canvas, CheckButton, Entry, Label, PhotoImage,
from .constants import *
__author__ = 'Xiaokang2022<2951256653@qq.com>'
__version__ = '2.6.5'
__version__ = '2.6.6.dev0'
__all__ = [
# Container Widgets
'Tk', 'Toplevel', 'Canvas',
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册