python-pen 2.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_pen-2.2.3/CHANGELOG.md +136 -0
- python_pen-2.2.3/LICENSE +21 -0
- python_pen-2.2.3/MANIFEST.in +28 -0
- python_pen-2.2.3/PKG-INFO +282 -0
- python_pen-2.2.3/README.md +250 -0
- python_pen-2.2.3/demo/__init__.py +1 -0
- python_pen-2.2.3/demo/demo.py +188 -0
- python_pen-2.2.3/icon_helper/README.md +148 -0
- python_pen-2.2.3/icon_helper/check_icon.py +96 -0
- python_pen-2.2.3/icon_helper/clean.py +49 -0
- python_pen-2.2.3/icon_helper/fix_icon.py +59 -0
- python_pen-2.2.3/pyproject.toml +64 -0
- python_pen-2.2.3/python_pen/__init__.py +2 -0
- python_pen-2.2.3/python_pen/core.py +1630 -0
- python_pen-2.2.3/python_pen/title_pic.ico +0 -0
- python_pen-2.2.3/python_pen.egg-info/PKG-INFO +282 -0
- python_pen-2.2.3/python_pen.egg-info/SOURCES.txt +19 -0
- python_pen-2.2.3/python_pen.egg-info/dependency_links.txt +1 -0
- python_pen-2.2.3/python_pen.egg-info/requires.txt +1 -0
- python_pen-2.2.3/python_pen.egg-info/top_level.txt +1 -0
- python_pen-2.2.3/setup.cfg +4 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
所有重要变更都会记录在此文件。
|
|
4
|
+
|
|
5
|
+
格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/)
|
|
6
|
+
版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)(SemVer)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
### Planned
|
|
13
|
+
- 更多教学示例与课堂演示脚本
|
|
14
|
+
- 对 Python 3.14+ 的兼容性预研
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## [2.2.3] - 2026-08-25 — 统一命名 & 历史归档版 🖤🐢
|
|
19
|
+
|
|
20
|
+
> ⚠️ **Name Change (Breaking Change for Package Name, Not API)**
|
|
21
|
+
> 从 2.2.3 起,PyPI 包名由 `pythonpendrawer` 统一为 `python_pen`,
|
|
22
|
+
> 安装名与导入名完全一致:`pip install python_pen` / `import python_pen`。
|
|
23
|
+
|
|
24
|
+
### ✨ 核心亮点 / Highlights
|
|
25
|
+
- **包名统一**:彻底解决“PyPI 名 ≠ 导入名”的历史遗留问题。
|
|
26
|
+
- **向后兼容**:旧代码 `from PythonPen import Pen` 仍可正常运行。
|
|
27
|
+
- **专业发版**:引入 CHANGELOG、规范 License、完善历史记录。
|
|
28
|
+
|
|
29
|
+
### ✅ 新增 / Added
|
|
30
|
+
- `python_pen.main()`:命令行入口函数。
|
|
31
|
+
- `python -m python_pen`:模块直接运行支持。
|
|
32
|
+
- `CHANGELOG.md`:独立历史变更日志文件(本文件)。
|
|
33
|
+
- `license-files = ["LICENSE", "CHANGELOG.md"]`:符合 PyPI 新规范。
|
|
34
|
+
- README 顶部增加“更名说明”,明确 `pythonpendrawer` 已归档。
|
|
35
|
+
|
|
36
|
+
### 🔧 变更 / Changed
|
|
37
|
+
- **PyPI 包名**:`pythonpendrawer` → `python_pen`
|
|
38
|
+
- **版本号**:`2.2.2` → `2.2.3`
|
|
39
|
+
- **项目链接**:全部指向 `https://pypi.org/project/python-pen/`
|
|
40
|
+
- **License 写法**:使用 SPDX `license = "MIT"` + `license-files`
|
|
41
|
+
- `__init__.py`:
|
|
42
|
+
- 显式暴露 `Pen`, `__version__`, `main`
|
|
43
|
+
- 增加模块文档字符串,说明命名变更历史
|
|
44
|
+
- `core.py`:
|
|
45
|
+
- 版本号更新为 `2.2.3`
|
|
46
|
+
- 增加 `sys.modules` 兼容层,支持旧导入名 `PythonPen`
|
|
47
|
+
|
|
48
|
+
### 🗑️ 弃用 / Deprecated
|
|
49
|
+
- `pythonpendrawer` (2.2.2):
|
|
50
|
+
- 已归档,不再更新
|
|
51
|
+
- 仅作为历史版本保留,供旧环境兼容使用
|
|
52
|
+
|
|
53
|
+
### 🐛 修复 / Fixed
|
|
54
|
+
- 无功能性修复(本版本为“命名与工程化”版本)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## [2.2.2] - 2026-08-20 — PyPI 初版(已归档)📦
|
|
59
|
+
|
|
60
|
+
> 本版本为首次公开发布至 PyPI 的版本,包名为 `pythonpendrawer`。
|
|
61
|
+
> 自 2.2.3 起,包名统一为 `python_pen`,本版本仅作历史存档。
|
|
62
|
+
|
|
63
|
+
### ✨ 核心亮点 / Highlights
|
|
64
|
+
- **首次登陆 PyPI**
|
|
65
|
+
- 中英双语 API 与帮助系统
|
|
66
|
+
- 内置铅笔图标与 Python Logo 绘制
|
|
67
|
+
|
|
68
|
+
### ✅ 新增 / Added
|
|
69
|
+
- 首次发布至 PyPI:`pip install pythonpendrawer`
|
|
70
|
+
- `draw_python_logo()`:绘制标准 Python Logo
|
|
71
|
+
- `random_shuffled()`:返回新列表,不修改原序列
|
|
72
|
+
- `demo.py`:5 幕演示流程
|
|
73
|
+
- `icon_helper/`:图标急救工具包
|
|
74
|
+
- `help()`:双语帮助系统
|
|
75
|
+
- 项目根目录 `README.md`(中英双语、表格化)
|
|
76
|
+
|
|
77
|
+
### 🐛 修复 / Fixed
|
|
78
|
+
- 彩虹方向错误(重写 `draw_rainbow()`)
|
|
79
|
+
- 螺旋线飞出画布(重构 `draw_colorful_spiral()`)
|
|
80
|
+
- `pen_restore_state(None)` 崩溃问题
|
|
81
|
+
- 等腰三角形底边校验逻辑
|
|
82
|
+
- `help()` 文档与实现不一致问题
|
|
83
|
+
|
|
84
|
+
### 🔧 变更 / Changed
|
|
85
|
+
- `help()` API 分类与教学顺序优化
|
|
86
|
+
- `demo.py` 移除五角星,聚焦核心图形
|
|
87
|
+
- 图标加载逻辑按操作系统自动适配
|
|
88
|
+
|
|
89
|
+
### 🗑️ 移除 / Removed
|
|
90
|
+
- 无
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## [2.1.2] - 2026-08-16 — 图标急救版 🖼️
|
|
95
|
+
|
|
96
|
+
### ✅ 新增 / Added
|
|
97
|
+
- `use_default_icon`:控制是否加载内置铅笔图标
|
|
98
|
+
- `set_icon()`:运行时切换窗口图标
|
|
99
|
+
- `icon_helper/` 工具包:
|
|
100
|
+
- `check_icon.py`
|
|
101
|
+
- `fix_icon.py`
|
|
102
|
+
- `make_icon.py`
|
|
103
|
+
- `clean.py`
|
|
104
|
+
- `icon_helper/README.txt`
|
|
105
|
+
|
|
106
|
+
### 🐛 修复 / Fixed
|
|
107
|
+
- Windows 下 Turtle 窗口图标不显示
|
|
108
|
+
- 图标缓存导致“改了没变化”问题
|
|
109
|
+
|
|
110
|
+
### 🔧 变更 / Changed
|
|
111
|
+
- 图标加载逻辑按 OS 自动适配
|
|
112
|
+
- 完善中英双语文档
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## [2.0.0] - 2026-08-14 — 首次公开发布 🎉
|
|
117
|
+
|
|
118
|
+
### ✅ 新增 / Added
|
|
119
|
+
- **Pen 类**:核心绘图封装
|
|
120
|
+
- 画笔控制:`pen_forward`, `pen_backward`, `pen_left`, `pen_right`, `pen_goto`, `pen_up`, `pen_down`
|
|
121
|
+
- 画布控制:`pen_clear`, `pen_reset`, `pen_tracer`, `pen_update`, `screen_exitonclick`
|
|
122
|
+
- 图形绘制:圆、正方形、矩形、等边三角形、多边形、星形、迷宫、随机艺术
|
|
123
|
+
- 数学常量:`PI`, `E`, `PHI`, `SQRT2`, `I`
|
|
124
|
+
- 双语支持:`lang="ch"` / `lang="en"`
|
|
125
|
+
- 内置铅笔图标:`title_pic.ico`
|
|
126
|
+
- 帮助系统:`help()`
|
|
127
|
+
- 初始文档:`README.txt`
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
<div align="center">
|
|
132
|
+
|
|
133
|
+
🖤🐢 **PythonPen Changelog**
|
|
134
|
+
by 11-year-old Coding Genius
|
|
135
|
+
|
|
136
|
+
</div>
|
python_pen-2.2.3/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 11-year-old Coding Genius
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# ==============================
|
|
2
|
+
# PythonPen 2.2.3 — MANIFEST.in
|
|
3
|
+
# ==============================
|
|
4
|
+
|
|
5
|
+
# 项目元信息
|
|
6
|
+
include pyproject.toml
|
|
7
|
+
include README.md
|
|
8
|
+
include LICENSE
|
|
9
|
+
include CHANGELOG.md
|
|
10
|
+
|
|
11
|
+
# ==============================
|
|
12
|
+
# python_pen 核心库
|
|
13
|
+
# ==============================
|
|
14
|
+
include python_pen/*.py
|
|
15
|
+
include python_pen/*.ico
|
|
16
|
+
|
|
17
|
+
# ==============================
|
|
18
|
+
# icon_helper 工具包
|
|
19
|
+
# ==============================
|
|
20
|
+
include icon_helper/*.py
|
|
21
|
+
include icon_helper/README.md
|
|
22
|
+
|
|
23
|
+
# ==============================
|
|
24
|
+
# demo(演示脚本,作为额外文件打包进 sdist)
|
|
25
|
+
# ==============================
|
|
26
|
+
include demo/__init__.py
|
|
27
|
+
include demo/demo.py
|
|
28
|
+
include demo/README.md
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python_pen
|
|
3
|
+
Version: 2.2.3
|
|
4
|
+
Summary: A teaching-friendly Python drawing library based on turtle, designed for beginners.
|
|
5
|
+
Author-email: 11-year-old Coding Genius <pythonpen@example.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://pypi.org/project/python-pen/
|
|
8
|
+
Project-URL: Repository, https://pypi.org/project/python-pen/
|
|
9
|
+
Project-URL: Documentation, https://pypi.org/project/python-pen/
|
|
10
|
+
Keywords: turtle,drawing,education,teaching,beginner,python-pen,python_pen,chinese,bilingual
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Natural Language :: Chinese (Simplified)
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Education
|
|
25
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: Pillow>=10.0
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# PythonPen — 让绘图像写字一样简单
|
|
34
|
+
|
|
35
|
+
> PythonPen is a lightweight drawing library that makes turtle graphics as easy as writing a sentence.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 📋 项目简介 / Introduction
|
|
40
|
+
|
|
41
|
+
**中文:**
|
|
42
|
+
PythonPen 是一个基于 Python `turtle` 的轻量级绘图库,专为初学者设计。
|
|
43
|
+
它把复杂的 turtle 操作封装成简单直观的**中英双语 API**,让你专注"画什么",而不是"怎么画"。
|
|
44
|
+
|
|
45
|
+
**English:**
|
|
46
|
+
PythonPen is a lightweight drawing library built on Python's `turtle` module, designed for beginners.
|
|
47
|
+
It wraps complex turtle operations into simple, intuitive **bilingual (Chinese/English) APIs**, so you can focus on *what* to draw, not *how*.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 👤 作者 / Author
|
|
52
|
+
|
|
53
|
+
| 项目 / Item | 内容 / Value |
|
|
54
|
+
|---|---|
|
|
55
|
+
| 姓名 / Name | 11 岁的小程序员 / 11-year-old Coding Genius |
|
|
56
|
+
| 版本 / Version | **v2.2.2** |
|
|
57
|
+
| 更新日期 / Updated | 2026-08-20 |
|
|
58
|
+
| Python 版本 / Python | 3.8+(推荐 3.13+) |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 📁 目录结构 / File Structure
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
PythonPenProject/ ← 项目根目录
|
|
66
|
+
├── README.md ← 你正在看的这个文件
|
|
67
|
+
├── CHANGELOG.md ← 更新日志
|
|
68
|
+
├── demo.py ← 主演示程序(推荐从这里运行)
|
|
69
|
+
│
|
|
70
|
+
├── PythonPen/ ← 核心库文件夹
|
|
71
|
+
│ ├── __init__.py ← 库入口
|
|
72
|
+
│ ├── core.py ← 核心实现(Pen 类)
|
|
73
|
+
│ └── title_pic.ico ← 内置铅笔图标
|
|
74
|
+
│
|
|
75
|
+
└── icon_helper/ ← 图标急救包(可选)
|
|
76
|
+
├── README.txt ← 图标问题说明书
|
|
77
|
+
├── make_icon.py ← 生成标准 ICO
|
|
78
|
+
├── fix_icon.py ← 修复 ICO 尺寸
|
|
79
|
+
├── check_icon.py ← 检查 ICO 内容
|
|
80
|
+
└── clean.py ← 清理缓存
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 🚀 安装 / Installation
|
|
86
|
+
|
|
87
|
+
> PythonPen **不需要** `pip install`,纯绿色,解压即用。
|
|
88
|
+
|
|
89
|
+
**中文:**
|
|
90
|
+
1. 确保已安装 Python 3.8 或更高版本
|
|
91
|
+
2. 把整个 `PythonPenProject` 文件夹放在任意位置
|
|
92
|
+
3. 在 `PythonPenProject` 目录下运行代码即可
|
|
93
|
+
|
|
94
|
+
**English:**
|
|
95
|
+
1. Make sure Python 3.8+ is installed
|
|
96
|
+
2. Place the entire `PythonPenProject` folder anywhere
|
|
97
|
+
3. Run your code from inside the `PythonPenProject` directory
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## ⚡ 快速开始 / Quick Start
|
|
102
|
+
|
|
103
|
+
打开终端,进入项目目录:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
cd PythonPenProject
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
运行主演示程序:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
python demo.py
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
你会看到 / You will see:
|
|
116
|
+
- ✅ 一个绘图窗口弹出 / A drawing window pops up
|
|
117
|
+
- ✅ 窗口显示 PythonPen 图标 / PythonPen icon in the title bar
|
|
118
|
+
- ✅ 依次展示 5 个演示场景 / 5 demo scenes play in sequence
|
|
119
|
+
- ✅ 点击窗口关闭 / Click the window to exit
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 📖 基本用法 / Basic Usage
|
|
124
|
+
|
|
125
|
+
### 中文模式(默认)/ Chinese Mode (Default)
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from PythonPen import Pen
|
|
129
|
+
|
|
130
|
+
pen = Pen(lang="ch")
|
|
131
|
+
pen.pen_forward(100)
|
|
132
|
+
pen.pen_right(90)
|
|
133
|
+
pen.draw_circle(50)
|
|
134
|
+
pen.screen_exitonclick()
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### English Mode
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from PythonPen import Pen
|
|
141
|
+
|
|
142
|
+
pen = Pen(lang="en")
|
|
143
|
+
pen.pen_forward(100)
|
|
144
|
+
pen.pen_right(90)
|
|
145
|
+
pen.draw_circle(50)
|
|
146
|
+
pen.screen_exitonclick()
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 不使用内置图标 / Disable Built-in Icon
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
pen = Pen(lang="ch", use_default_icon=False)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 使用自定义图标 / Use Custom Icon
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
pen = Pen(lang="ch", use_default_icon=False)
|
|
159
|
+
pen.set_icon(r"C:\path\to\your_icon.ico")
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 🎨 内置功能一览 / Feature Reference
|
|
165
|
+
|
|
166
|
+
### 📋 数学常量 / Math Constants
|
|
167
|
+
```
|
|
168
|
+
self.E, self.I, self.PI, self.PHI, self.SQRT2
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 🎨 基础控制 / Basic Control
|
|
172
|
+
```
|
|
173
|
+
bg, style, set_icon, lang
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 🚀 画笔移动 / Pen Movement
|
|
177
|
+
```
|
|
178
|
+
pen_forward, pen_backward, pen_left, pen_right
|
|
179
|
+
pen_goto, pen_home, pen_setheading
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 📍 画布与状态 / Canvas & State
|
|
183
|
+
```
|
|
184
|
+
pen_clear, pen_reset, pen_pos
|
|
185
|
+
pen_save_state, pen_restore_state
|
|
186
|
+
pen_tracer, pen_update
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### 🖊️ 文本与交互 / Text & Interaction
|
|
190
|
+
```
|
|
191
|
+
pen_write, pen_stamp, pen_clear_stamp
|
|
192
|
+
pen_num_input, pen_text_input
|
|
193
|
+
pen_set_title, pen_delay
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 🌈 时间与颜色 / Time & Color
|
|
197
|
+
```
|
|
198
|
+
show_detailed_time, set_color_mode, get_color_mode
|
|
199
|
+
random_color, random_int, random_float
|
|
200
|
+
random_choice, random_shuffled
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### ▣ 窗口控制 / Window Control
|
|
204
|
+
```
|
|
205
|
+
screen_exitonclick, screen_mainloop, screen_bye
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 🔺 基础图形 / Basic Shapes
|
|
209
|
+
```
|
|
210
|
+
draw_circle, draw_square, draw_rectangle
|
|
211
|
+
draw_equilateral_triangle, draw_isosceles_triangle
|
|
212
|
+
draw_polygon
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 🔷 高级图形 / Advanced Shapes
|
|
216
|
+
```
|
|
217
|
+
draw_star, draw_python_logo
|
|
218
|
+
draw_colorful_spiral, draw_rainbow
|
|
219
|
+
draw_maze, draw_random_art
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 🎯 工具与扩展 / Utilities
|
|
223
|
+
```
|
|
224
|
+
drawing_challenge, help
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 🖼️ 图标问题?/ Icon Issues?
|
|
230
|
+
|
|
231
|
+
如果你发现图标不显示、是灰色的、或改了没变化,请查看:
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
icon_helper/README.txt
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
里面有一整套工具,专门解决图标问题。
|
|
238
|
+
The `icon_helper/` folder contains a complete toolkit for icon troubleshooting.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 💡 设计理念 / Design Philosophy
|
|
243
|
+
|
|
244
|
+
| # | 中文 | English |
|
|
245
|
+
|---|---|---|
|
|
246
|
+
| 1 | **简单优先** — API 直觉化,零门槛上手 | **Simplicity First** — Intuitive APIs, zero learning curve |
|
|
247
|
+
| 2 | **双语支持** — 中英文无缝切换 | **Bilingual** — Seamless Chinese/English switching |
|
|
248
|
+
| 3 | **零依赖** — 仅用标准库,无需 pip | **Zero Dependencies** — Standard library only |
|
|
249
|
+
| 4 | **优雅退出** — 窗口关闭不报错 | **Graceful Exit** — No errors on window close |
|
|
250
|
+
| 5 | **用户可控** — 图标、语言、样式全可选 | **User Empowerment** — Icon, language, style all optional |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 🙏 致谢 / Acknowledgements
|
|
255
|
+
|
|
256
|
+
**中文:**
|
|
257
|
+
感谢 Python `turtle` 模块,
|
|
258
|
+
感谢所有帮助测试的人,
|
|
259
|
+
感谢每一个用代码创造美好的你。
|
|
260
|
+
|
|
261
|
+
**English:**
|
|
262
|
+
Thanks to the Python `turtle` module,
|
|
263
|
+
thanks to everyone who helped test,
|
|
264
|
+
and thanks to **you** — creating beauty with code.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## 📄 License
|
|
269
|
+
|
|
270
|
+
MIT License — 随便用,随便改,注明出处就行。
|
|
271
|
+
MIT License — Free to use, modify, and share. Just keep the attribution.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
<div align="center">
|
|
276
|
+
|
|
277
|
+
**"代码是写给人看的,顺便给机器执行。"**
|
|
278
|
+
*"Code is written for humans, machines just happen to run it."*
|
|
279
|
+
|
|
280
|
+
🖤🐢 **PythonPen v2.2.3** — by 11-year-old Coding Genius
|
|
281
|
+
|
|
282
|
+
</div>
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# PythonPen — 让绘图像写字一样简单
|
|
2
|
+
|
|
3
|
+
> PythonPen is a lightweight drawing library that makes turtle graphics as easy as writing a sentence.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📋 项目简介 / Introduction
|
|
8
|
+
|
|
9
|
+
**中文:**
|
|
10
|
+
PythonPen 是一个基于 Python `turtle` 的轻量级绘图库,专为初学者设计。
|
|
11
|
+
它把复杂的 turtle 操作封装成简单直观的**中英双语 API**,让你专注"画什么",而不是"怎么画"。
|
|
12
|
+
|
|
13
|
+
**English:**
|
|
14
|
+
PythonPen is a lightweight drawing library built on Python's `turtle` module, designed for beginners.
|
|
15
|
+
It wraps complex turtle operations into simple, intuitive **bilingual (Chinese/English) APIs**, so you can focus on *what* to draw, not *how*.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 👤 作者 / Author
|
|
20
|
+
|
|
21
|
+
| 项目 / Item | 内容 / Value |
|
|
22
|
+
|---|---|
|
|
23
|
+
| 姓名 / Name | 11 岁的小程序员 / 11-year-old Coding Genius |
|
|
24
|
+
| 版本 / Version | **v2.2.2** |
|
|
25
|
+
| 更新日期 / Updated | 2026-08-20 |
|
|
26
|
+
| Python 版本 / Python | 3.8+(推荐 3.13+) |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 📁 目录结构 / File Structure
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
PythonPenProject/ ← 项目根目录
|
|
34
|
+
├── README.md ← 你正在看的这个文件
|
|
35
|
+
├── CHANGELOG.md ← 更新日志
|
|
36
|
+
├── demo.py ← 主演示程序(推荐从这里运行)
|
|
37
|
+
│
|
|
38
|
+
├── PythonPen/ ← 核心库文件夹
|
|
39
|
+
│ ├── __init__.py ← 库入口
|
|
40
|
+
│ ├── core.py ← 核心实现(Pen 类)
|
|
41
|
+
│ └── title_pic.ico ← 内置铅笔图标
|
|
42
|
+
│
|
|
43
|
+
└── icon_helper/ ← 图标急救包(可选)
|
|
44
|
+
├── README.txt ← 图标问题说明书
|
|
45
|
+
├── make_icon.py ← 生成标准 ICO
|
|
46
|
+
├── fix_icon.py ← 修复 ICO 尺寸
|
|
47
|
+
├── check_icon.py ← 检查 ICO 内容
|
|
48
|
+
└── clean.py ← 清理缓存
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 🚀 安装 / Installation
|
|
54
|
+
|
|
55
|
+
> PythonPen **不需要** `pip install`,纯绿色,解压即用。
|
|
56
|
+
|
|
57
|
+
**中文:**
|
|
58
|
+
1. 确保已安装 Python 3.8 或更高版本
|
|
59
|
+
2. 把整个 `PythonPenProject` 文件夹放在任意位置
|
|
60
|
+
3. 在 `PythonPenProject` 目录下运行代码即可
|
|
61
|
+
|
|
62
|
+
**English:**
|
|
63
|
+
1. Make sure Python 3.8+ is installed
|
|
64
|
+
2. Place the entire `PythonPenProject` folder anywhere
|
|
65
|
+
3. Run your code from inside the `PythonPenProject` directory
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## ⚡ 快速开始 / Quick Start
|
|
70
|
+
|
|
71
|
+
打开终端,进入项目目录:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cd PythonPenProject
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
运行主演示程序:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python demo.py
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
你会看到 / You will see:
|
|
84
|
+
- ✅ 一个绘图窗口弹出 / A drawing window pops up
|
|
85
|
+
- ✅ 窗口显示 PythonPen 图标 / PythonPen icon in the title bar
|
|
86
|
+
- ✅ 依次展示 5 个演示场景 / 5 demo scenes play in sequence
|
|
87
|
+
- ✅ 点击窗口关闭 / Click the window to exit
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 📖 基本用法 / Basic Usage
|
|
92
|
+
|
|
93
|
+
### 中文模式(默认)/ Chinese Mode (Default)
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from PythonPen import Pen
|
|
97
|
+
|
|
98
|
+
pen = Pen(lang="ch")
|
|
99
|
+
pen.pen_forward(100)
|
|
100
|
+
pen.pen_right(90)
|
|
101
|
+
pen.draw_circle(50)
|
|
102
|
+
pen.screen_exitonclick()
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### English Mode
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from PythonPen import Pen
|
|
109
|
+
|
|
110
|
+
pen = Pen(lang="en")
|
|
111
|
+
pen.pen_forward(100)
|
|
112
|
+
pen.pen_right(90)
|
|
113
|
+
pen.draw_circle(50)
|
|
114
|
+
pen.screen_exitonclick()
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 不使用内置图标 / Disable Built-in Icon
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
pen = Pen(lang="ch", use_default_icon=False)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 使用自定义图标 / Use Custom Icon
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
pen = Pen(lang="ch", use_default_icon=False)
|
|
127
|
+
pen.set_icon(r"C:\path\to\your_icon.ico")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🎨 内置功能一览 / Feature Reference
|
|
133
|
+
|
|
134
|
+
### 📋 数学常量 / Math Constants
|
|
135
|
+
```
|
|
136
|
+
self.E, self.I, self.PI, self.PHI, self.SQRT2
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 🎨 基础控制 / Basic Control
|
|
140
|
+
```
|
|
141
|
+
bg, style, set_icon, lang
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 🚀 画笔移动 / Pen Movement
|
|
145
|
+
```
|
|
146
|
+
pen_forward, pen_backward, pen_left, pen_right
|
|
147
|
+
pen_goto, pen_home, pen_setheading
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 📍 画布与状态 / Canvas & State
|
|
151
|
+
```
|
|
152
|
+
pen_clear, pen_reset, pen_pos
|
|
153
|
+
pen_save_state, pen_restore_state
|
|
154
|
+
pen_tracer, pen_update
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 🖊️ 文本与交互 / Text & Interaction
|
|
158
|
+
```
|
|
159
|
+
pen_write, pen_stamp, pen_clear_stamp
|
|
160
|
+
pen_num_input, pen_text_input
|
|
161
|
+
pen_set_title, pen_delay
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 🌈 时间与颜色 / Time & Color
|
|
165
|
+
```
|
|
166
|
+
show_detailed_time, set_color_mode, get_color_mode
|
|
167
|
+
random_color, random_int, random_float
|
|
168
|
+
random_choice, random_shuffled
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### ▣ 窗口控制 / Window Control
|
|
172
|
+
```
|
|
173
|
+
screen_exitonclick, screen_mainloop, screen_bye
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 🔺 基础图形 / Basic Shapes
|
|
177
|
+
```
|
|
178
|
+
draw_circle, draw_square, draw_rectangle
|
|
179
|
+
draw_equilateral_triangle, draw_isosceles_triangle
|
|
180
|
+
draw_polygon
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 🔷 高级图形 / Advanced Shapes
|
|
184
|
+
```
|
|
185
|
+
draw_star, draw_python_logo
|
|
186
|
+
draw_colorful_spiral, draw_rainbow
|
|
187
|
+
draw_maze, draw_random_art
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 🎯 工具与扩展 / Utilities
|
|
191
|
+
```
|
|
192
|
+
drawing_challenge, help
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 🖼️ 图标问题?/ Icon Issues?
|
|
198
|
+
|
|
199
|
+
如果你发现图标不显示、是灰色的、或改了没变化,请查看:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
icon_helper/README.txt
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
里面有一整套工具,专门解决图标问题。
|
|
206
|
+
The `icon_helper/` folder contains a complete toolkit for icon troubleshooting.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 💡 设计理念 / Design Philosophy
|
|
211
|
+
|
|
212
|
+
| # | 中文 | English |
|
|
213
|
+
|---|---|---|
|
|
214
|
+
| 1 | **简单优先** — API 直觉化,零门槛上手 | **Simplicity First** — Intuitive APIs, zero learning curve |
|
|
215
|
+
| 2 | **双语支持** — 中英文无缝切换 | **Bilingual** — Seamless Chinese/English switching |
|
|
216
|
+
| 3 | **零依赖** — 仅用标准库,无需 pip | **Zero Dependencies** — Standard library only |
|
|
217
|
+
| 4 | **优雅退出** — 窗口关闭不报错 | **Graceful Exit** — No errors on window close |
|
|
218
|
+
| 5 | **用户可控** — 图标、语言、样式全可选 | **User Empowerment** — Icon, language, style all optional |
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 🙏 致谢 / Acknowledgements
|
|
223
|
+
|
|
224
|
+
**中文:**
|
|
225
|
+
感谢 Python `turtle` 模块,
|
|
226
|
+
感谢所有帮助测试的人,
|
|
227
|
+
感谢每一个用代码创造美好的你。
|
|
228
|
+
|
|
229
|
+
**English:**
|
|
230
|
+
Thanks to the Python `turtle` module,
|
|
231
|
+
thanks to everyone who helped test,
|
|
232
|
+
and thanks to **you** — creating beauty with code.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 📄 License
|
|
237
|
+
|
|
238
|
+
MIT License — 随便用,随便改,注明出处就行。
|
|
239
|
+
MIT License — Free to use, modify, and share. Just keep the attribution.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
<div align="center">
|
|
244
|
+
|
|
245
|
+
**"代码是写给人看的,顺便给机器执行。"**
|
|
246
|
+
*"Code is written for humans, machines just happen to run it."*
|
|
247
|
+
|
|
248
|
+
🖤🐢 **PythonPen v2.2.3** — by 11-year-old Coding Genius
|
|
249
|
+
|
|
250
|
+
</div>
|