Skip to content

Commit

Permalink
Many changes
Browse files Browse the repository at this point in the history
  • Loading branch information
qfcy committed Dec 15, 2024
1 parent c235756 commit 4a7b930
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 84 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ dist:使用pyinstaller的打包exe文件,及用Inno Setup制作的安装包
不过,仓库里面有获奖作品的申报材料,留给需要做信息技术竞赛的同学做参考。

## 四.常见问题
Q: 为什么本项目主要使用了turtle库,而不用其他更高级的图形库
Q: 为什么本项目使用了turtle库渲染tkinter.Canvas的界面,而不直接使用tkinter,或其他图形库
A: 首先,作者本想用tkinter库编写该程序,但考虑到直接调用Canvas控件绘制行星形状的代码量较大,而且基于tkinter的turtle库封装了tkinter,能够间接调用Canvas控件进行绘图,就使用turtle库绘制图形,避免重复造轮子。
目前,程序中的界面主要使用tkinter库设计,而基于tkinter的turtle库仅用于渲染。另外,作者基于自己的tkinter知识,重写和扩展了原版turtle模块,如`TESTS\solar_system_blackhole2.py`基于PIL库为turtle添加了图像旋转功能。
其次,使用turtle库可减少图形渲染的代码,将主要精力用于物理算法的设计,以及其他功能的开发上。
Expand Down Expand Up @@ -168,7 +168,7 @@ However, there are application materials for award-winning works in the reposito

## 4.Q&A

Q: Why does this project primarily use the turtle module instead of other more advanced graphics libraries?
Q: Why does this project utilize turtle to render the `tkinter.Canvas` interface instead of using tkinter directly or other graphics libraries?
A: Initially, I intended to use the tkinter module to write the program, but considering the substantial amount of code required to directly manipulate the Canvas widget for drawing planetary shapes, while the turtle module based on tkinter encapsulates many tkinter functions and can indirectly invoke the Canvas widget for drawing, the turtle module was chosen for rendering to avoid reinventing wheels.
Currently, the program's interface is mainly designed using the tkinter module, while the turtle module, which is based on tkinter, is only used for rendering. Additionally, I has rewritten and extended the original turtle module based on their knowledge of tkinter, such as adding image rotation functionality to turtle using the PIL library in `TESTS\solar_system_blackhole2.py`.
Furthermore, using the turtle module reduces the amount of code needed for graphic rendering, allowing the main focus to be on designing the physics algorithms and developing other features.
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Increase the distance from the moon to the earth continuously. The moon will be

支持跟踪行星、切换行星,包含简单的发射“飞船”功能。

图形部分使用turtle(tkinter)或Pygame库。
图形部分使用tkinter(turtle)或Pygame库。

你能在其中创造一个属于自己的宇宙。

Expand Down Expand Up @@ -151,7 +151,7 @@ y\ :sub:`B`\ \| /md。
四.常见问题
===========

Q: 为什么本项目主要使用了turtle库,而不用其他更高级的图形库
Q: 为什么本项目使用了turtle库渲染tkinter.Canvas的界面,而不直接使用tkinter,或其他图形库

A: 首先,作者本想用tkinter库编写该程序,但考虑到直接调用Canvas控件绘制行星形状的代码量较大,而且基于tkinter的turtle库封装了tkinter,能够间接调用Canvas控件进行绘图,就使用turtle库绘制图形,避免重复造轮子。

Expand Down Expand Up @@ -289,7 +289,7 @@ However, there are application materials for award-winning works in the reposito
4.Q&A
=====

Q: Why does this project primarily use the turtle module instead of other more advanced graphics libraries?
Q: Why does this project utilize turtle to render the tkinter.Canvas interface instead of using tkinter directly or other graphics libraries?

A: Initially, I intended to use the tkinter module to write the program, but considering the substantial amount of code required to directly manipulate the Canvas widget for drawing planetary shapes, while the turtle module based on tkinter encapsulates many tkinter functions and can indirectly invoke the Canvas widget for drawing, the turtle module was chosen for rendering to avoid reinventing wheels. Currently, the program's interface is mainly designed using the tkinter module, while the turtle module, which is based on tkinter, is only used for rendering. Additionally, I has rewritten and extended the original turtle module based on their knowledge of tkinter, such as adding image rotation functionality to turtle using the PIL library in `TESTS\\solar\_system\_blackhole2.py`. Furthermore, using the turtle module reduces the amount of code needed for graphic rendering, allowing the main focus to be on designing the physics algorithms and developing other features.

Expand Down
4 changes: 2 additions & 2 deletions build/lib.win32-cpython-37/solar_system/solar_system.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
使用turtle模块的太阳系模拟程序
使用tkinter以及turtle模块的太阳系模拟程序。
快捷键:
按Ctrl+“+”或Ctrl+“-”进行缩放。
Expand All @@ -27,7 +27,7 @@
except ImportError:
from Tkinter import TclError # Python 2

__author__="七分诚意 qq:3076711200"
__author__="qfcy qq:3076711200"
__email__="[email protected]"
__version__="1.3.3"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from random import randrange
from turtle import Shape, Turtle, update, Screen, Terminator, Vec2D as Vec, mainloop

__author__="七分诚意 qq:3076711200"
__author__="qfcy qq:3076711200"
__email__="[email protected]"
__version__="1.0.3"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
except ImportError:
from Tkinter import TclError

__author__="七分诚意 qq:3076711200"
__author__="qfcy qq:3076711200"
__email__="[email protected]"
__version__="1.1.1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
except ImportError:
from Tkinter import TclError

__author__="七分诚意 qq:3076711200"
__author__="qfcy qq:3076711200"
__email__="[email protected]"
__version__="1.2.04"

Expand Down
Binary file modified dist/solar-system-1.3.3.tar.gz
Binary file not shown.
Binary file modified dist/solar_system-1.3.3-cp37-cp37m-win32.whl
Binary file not shown.
15 changes: 15 additions & 0 deletions make_pyinstaller.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off
pyinstaller "solar_system\싱야경\多제친콰 - 뒤寧、랗倒壟醵똑.py" -i solar_system\dist\暠깃.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\싱야경\多제친콰 - 역팹잇뒤寧땍쪼.py" -i solar_system\dist\暠깃.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\싱야경\多제친콰 - 역팹잇뒤랗땍쪼.py" -i solar_system\dist\暠깃.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\싱야경\多제친콰 - 역팹잇뒤힛땍쪼.py" -i solar_system\dist\暠깃.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\싱야경\多제친콰 - 휑뒈墩.py" -i solar_system\dist\暠깃.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\싱야경\多제친콰 - 格捺溝.py" -i solar_system\dist\暠깃.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\싱야경\多제친콰 - 括槿긴뱀.py" -i solar_system\dist\暠깃.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\ENG\cosmic_velocities.py" -i solar_system\ENG\dist\icon.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\ENG\kepler_1st.py" -i solar_system\ENG\dist\icon.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\ENG\kepler_2nd.py" -i solar_system\ENG\dist\icon.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\ENG\kepler_3rd.py" -i solar_system\ENG\dist\icon.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\ENG\satellite_orbit_change.py" -i solar_system\ENG\dist\icon.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\ENG\solar_system_with_controls.py" -i solar_system\ENG\dist\icon.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
pyinstaller "solar_system\ENG\sun_earth_moon.py" -i solar_system\ENG\dist\icon.ico -w --hidden-import tkinter.simpledialog --exclude-module solar_system --exclude-module turtle --noconfirm
16 changes: 10 additions & 6 deletions solar_system.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Name: solar-system
Version: 1.3.3
Summary: Python模拟万有引力、太阳系行星运动的库,模拟天体轨道,验证开普勒三大定律。Computer simulation of gravity and planetary motion in the solar system,emulating the orbits of celestial bodies and verifying Kepler's three laws.
Home-page: https://github.com/qfcy/python-gravity-simulation
Author: 七分诚意 qq:3076711200
Author: qfcy qq:3076711200
Author-email: [email protected]
Keywords: solar,system,solarsys,turtle,graphics,astronomy,gravity,physics,太阳系,引力,模拟,物理,天文,mercury,venus,earth,mars,jupiter,saturn,uranus,neptune,pluto
Classifier: Programming Language :: Python
Expand Down Expand Up @@ -36,7 +36,7 @@ Increase the distance from the moon to the earth continuously. The moon will be

支持跟踪行星、切换行星,包含简单的发射“飞船”功能。

图形部分使用turtle(tkinter)或Pygame库。
图形部分使用tkinter(turtle)或Pygame库。

你能在其中创造一个属于自己的宇宙。

Expand All @@ -58,6 +58,8 @@ You’re able to create a universe belonging to yourself in this program. Additi
一.各个文件的介绍
=================

源代码位于solar_system目录中。

1.主程序
--------

Expand Down Expand Up @@ -164,9 +166,9 @@ y\ :sub:`B`\ \| /md。
四.常见问题
===========

Q: 为什么本项目主要使用了turtle库,而不用其他更高级的图形库
Q: 为什么本项目使用了turtle库渲染tkinter.Canvas的界面,而不直接使用tkinter,或其他图形库

A: 首先,作者本想用tkinter库编写该程序,但考虑到直接调用Canvas控件绘制行星形状的代码量较大,而且由于基于tkinter的turtle库封装了tkinter,能够间接调用Canvas控件进行绘图,就使用turtle库绘制图形。
A: 首先,作者本想用tkinter库编写该程序,但考虑到直接调用Canvas控件绘制行星形状的代码量较大,而且基于tkinter的turtle库封装了tkinter,能够间接调用Canvas控件进行绘图,就使用turtle库绘制图形,避免重复造轮子

目前,程序中的界面主要使用tkinter库设计,而基于tkinter的turtle库仅用于渲染。另外,作者基于自己的tkinter知识,重写和扩展了原版turtle模块,如`TESTS\solar_system_blackhole2.py`基于PIL库为turtle添加了图像旋转功能。

Expand All @@ -190,6 +192,8 @@ bilibili主页:\ `qfcy\_ <https://space.bilibili.com/454233262>`__
1.The introduction to each file
===============================

The source code is located in the solar_system directory.

(1) Main program
----------------

Expand Down Expand Up @@ -300,9 +304,9 @@ However, there are application materials for award-winning works in the reposito
4.Q&A
=====

Q: Why does this project primarily use the turtle library instead of other more advanced graphics libraries?
Q: Why does this project utilize turtle to render the tkinter.Canvas interface instead of using tkinter directly or other graphics libraries?

A: Initially, I intended to use the tkinter library to write the program, but considering the substantial amount of code required to directly manipulate the Canvas widget for drawing planetary shapes, while the turtle module based on tkinter encapsulates many tkinter functions and can indirectly invoke the Canvas widget for drawing, the turtle library was chosen for rendering graphics. Currently, the program's interface is mainly designed using the tkinter library, while the turtle library, which is based on tkinter, is only used for rendering. Additionally, I has rewritten and extended the original turtle module based on their knowledge of tkinter, such as adding image rotation functionality to turtle using the PIL library in `TESTS\\solar\_system\_blackhole2.py`. Furthermore, using the turtle library reduces the amount of code needed for graphic rendering, allowing the main focus to be on designing the physics algorithms and developing other features.
A: Initially, I intended to use the tkinter module to write the program, but considering the substantial amount of code required to directly manipulate the Canvas widget for drawing planetary shapes, while the turtle module based on tkinter encapsulates many tkinter functions and can indirectly invoke the Canvas widget for drawing, the turtle module was chosen for rendering to avoid reinventing wheels. Currently, the program's interface is mainly designed using the tkinter module, while the turtle module, which is based on tkinter, is only used for rendering. Additionally, I has rewritten and extended the original turtle module based on their knowledge of tkinter, such as adding image rotation functionality to turtle using the PIL library in `TESTS\\solar\_system\_blackhole2.py`. Furthermore, using the turtle module reduces the amount of code needed for graphic rendering, allowing the main focus to be on designing the physics algorithms and developing other features.

Q: What are the known factors contributing to the precision loss in calculations?

Expand Down
Binary file modified solar_system/ENG/dist/Python-gravity-simulation-portable.zip
Binary file not shown.
16 changes: 3 additions & 13 deletions solar_system/ENG/dist/Setup script.iss
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ Source: "Python-gravity-simulation-portable\default.xlsx"; DestDir: "{app}"; Fla
Source: "Python-gravity-simulation-portable\kepler_1st.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\kepler_2nd.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\kepler_3rd.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\libcrypto-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\libopenblas.VTYUM5MXKVFE4PZZER3L7PNO6YB4XFF3.gfortran-win32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\libssl-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\MSVCP140.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\pyexpat.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\pyparsing.pyc"; DestDir: "{app}"; Flags: ignoreversion
Expand All @@ -89,29 +87,21 @@ Source: "Python-gravity-simulation-portable\README.md"; DestDir: "{app}"; Flags:
Source: "Python-gravity-simulation-portable\satellite_orbit_change.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\select.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\solar_system_with_controls.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\sqlite3.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\sun_earth_moon.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\tcl86t.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\tk86t.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\turtle.pyc"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\ucrtbase.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\unicodedata.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\VCRUNTIME140.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_bz2.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_ctypes.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_curses.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_decimal.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_elementtree.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_hashlib.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_lzma.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_multiprocessing.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_queue.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_socket.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_sqlite3.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_ssl.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_testcapi.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\_tkinter.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\solar_system\__init__.pyc"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\solar_system\solar_system.pyc"; DestDir: "{app}"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\solar_system\__init__.pyc"; DestDir: "{app}\solar_system"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\solar_system\solar_system.pyc"; DestDir: "{app}\solar_system"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\numpy\core\_multiarray_tests.cp37-win32.pyd"; DestDir: "{app}\numpy\core"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\numpy\core\_multiarray_umath.cp37-win32.pyd"; DestDir: "{app}\numpy\core"; Flags: ignoreversion
Source: "Python-gravity-simulation-portable\numpy\fft\_pocketfft_internal.cp37-win32.pyd"; DestDir: "{app}\numpy\fft"; Flags: ignoreversion
Expand Down
Binary file modified solar_system/ENG/dist/Setup.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion solar_system/ENG/solar_system.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
Solar System Simulation using turtle module.
Solar System Simulation using tkinter and turtle module.
Shortcut keys:
Press Ctrl+"+" or Ctrl+"-" to zoom.
Expand Down
3 changes: 2 additions & 1 deletion solar_system/ENG/solar_system_with_controls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
Solar System Simulation using turtle module with tkinter for control buttons.
Solar System Simulation using tkinter with control buttons.
Shortcut keys:
Press Ctrl+"+" or Ctrl+"-" to zoom.
Expand Down Expand Up @@ -408,6 +408,7 @@ def exit():
def main():
global scr,gs,win
scr=Screen()
scr.title("Python gravity simulator")
scr.screensize(6000,6000)
try:
scr._canvas.master.state("zoomed")
Expand Down
Binary file modified solar_system/dist/安装包.exe
Binary file not shown.
Loading

0 comments on commit 4a7b930

Please sign in to comment.