1

This is a follow-up off my first post, Workaround for exporting larger Postscript files (.eps) via Python-turtle

In short, I spend last evening and this morning studying cdlane’s “The key”. And had some problems with the x- and y-positioning, i.e. the coordination, but I was able to tackle that issue.

This is my 5th study following cdlane's suggestions, including the complete adjusted & CORRECTED code:

# - - - - - - - - - - - - - - - - - 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!"

NOW THE PROGRAM WORKS! COOL! WONDERFUL! Thanks you all for your contributions which kept me going.

  • Note that PostScript (and PDF) doesn't work in pixels, it works in units, which are 1/72 inch. So the exact number of pixels depends on the resolution. Technically PostScript doesn't have a 'circle' primitive, you need to construct a circle using the arc operator (x y r 0 360 will draw a circle radius r centered at location x,y). You can also use Bezier curves, but that's less accurate and may be the problem you are experiencing. In PDF you **have** to use Beziers... If you put the EPS or PDF somewhere I can have a look at either for you. Not that I can tell you how to fix it! – KenS Apr 15 '23 at 14:26
  • 1
    OOPS, while reproducing and working on the code in ACSLOGO I discovered I made some mistakes in my calculus. So I corrected both ACSLOGO and Python-turtle. To my surprise, I actually run/run the program twice, as it seems the adjusted corrected code works. ? WOW. PROBLEM SOLVED! – user21640453 Apr 16 '23 at 10:02
  • 1
    THANK YOU ALL for your contributions, which kept me going. s – user21640453 Apr 16 '23 at 11:07

0 Answers0