这是我第一篇文章的后续内容,通过 Python-turtle 导出较大 Postscript 文件 (.eps) 的解决方法
简而言之,我昨晚和今天早上都在研究 cdlane 的《The key》。
在 x 和 y 定位(即协调)方面存在一些问题,但我能够解决这个问题。
这是我按照 cdlane 的建议进行的第五次研究,包括完整的调整和更正的代码:
# - - - - - - - - - - - - - - - - - 16.4.2023
# - - - - - - - - - - - - - - - - - COPY cdlane
# - - - - - - - - - - - - - - - - - 05 RERE-corrected
# - - - - - - - - - - - - - - - - - CALL
from turtle import Screen
from turtle import *
# - - - - - - - - - - - - - - - - - A3 +
screen = Screen()
# - - - - - - - - - - - - - - - - - half 1708.1208
screen.setup(854,604)
# - - - - - - - - - - - - - - - - - CORRECTED
screen.screensize(1708,1208)
# - - - - - - - - - - - - - - - - - CLASSIC
mode("logo")
shape("turtle")
# - - - - - - - - - - - - - - - - - RGB
pensize(1)
colormode(255)
# - - - - - - - - - - - - - - - - - MAIN
# - - - - - - - - - - - - - - - - - insert: frame A3
pencolor(0,0,255)
pu()
goto(-794,562)
seth(90)
pd()
for loop in range(2):
fd(1588)
rt(90)
fd(1124)
rt(90)
# - - - - - - - - - - - - - - - - - insert: frame display
pu()
goto(-427,302)
seth(90)
pd()
for loop in range(2):
fd(854)
rt(90)
fd(604)
rt(90)
# - - - - - - - - - - - - - - - - - axis display
pencolor(255,0,0)
# - - - - - - - - - - - - - - - - - X
pu()
goto(-427,0)
seth(90)
pd()
fd(854)
# - - - - - - - - - - - - - - - - - Y
pu()
goto(0,302)
seth(180)
pd()
fd(604)
# - - - - - - - - - - - - - - - - - CIRCLES
pencolor(0,0,0)
seth(0)
# - - - - - - - - - - - - - - - - - fits display
pu()
goto(302,0)
pd()
circle(302)
# - - - - - - - - - - - - - - - - - expands display
pu()
goto(562,0)
pd()
circle(562)
# - - - - - - - - - - - - - - - - - ROUND UP
canvas = screen.getcanvas()
canvas.postscript(file="05_RERE-corrected.eps", x=-854,
y=-604, width=1708, height=1208)
# - - - - - - - - - - - - - - - - - END
print()
print("DONE!"
现在程序可以运行了!凉爽的!精彩的!
感谢大家的贡献,让我继续前进。