0

I am searching for a way to export a larger vector “image” while using Python-turtle.

I traced the next “method”, which suits me fine, because I can open the Postscript file as a vector in Adobe Illustrator.

This is the code:

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2023.4.14
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FIRST
from tkinter import *
from turtle import *
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A3 = 1587.1183
screensize(1720,1320)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MAIN

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ROUND_UP
ts = getscreen()
ts.getcanvas().postscript(file = “first.eps”)

Note that since my screen size (1720x1320) is larger then my laptop-display-screen (1366x768) the python-turtle window opens with two scrollbars, i.e. a part of the drawing is always hidden.

Of course the output, i.e. the .eps resembles the visual part of the drawing as shown on my laptop. Ergo the command “getscreen()” does exactly what it suggests.

Is there a workaround, which will export the complete vector? Possibly by including the tkinter “ScrolledCanvas(master)” command?

M--
  • 25,431
  • 8
  • 61
  • 93
  • 1
    You can use the `pagewidth` option of `.postscript()` to specify the output page width, for example `.postscript(file="...", pagewidth="5i")` to set the page width to 5 inches. – acw1668 Apr 14 '23 at 07:54
  • Thanks, I 'll try. And let you know. – user21640453 Apr 14 '23 at 10:42
  • 1
    Perhaps my answer to [Saving turtle drawing in python](https://stackoverflow.com/a/70172308/5771269) will help you as it addresses saving an image larger the window on the screen. – cdlane Apr 14 '23 at 17:21
  • Concerning the first contribution from KenS. Like you suggested I included the page width and height in inches in the "ROUND_UP section". i.e "ts.getcanvas().postscript(file = “first.eps”, pagewidth="17i",pageheight="13i") but i am sorry it did not help, which did not surprise me because the "ts=getscreen()" command above and thus first. (Deleting "getscreen()" is not an option because the program will not run. – user21640453 Apr 14 '23 at 19:34
  • Now I will study the contribution of cdlane. Thank you. – user21640453 Apr 14 '23 at 19:35
  • Dear Gents, dear mr. Ken, dear mr. CDLang, if you have the time please check my latest update which posted as "Is there a workaround exporting larger Postscript files (.eps) via Python-turtle? [2]". This is the hyperlink >>> https://stackoverflow.com/questions/76022511/is-there-a-workaround-exporting-larger-postscript-files-eps-via-python-turtle Thanks – user21640453 Apr 15 '23 at 13:20
  • 2
    Duplicate of [Is there a workaround exporting larger Postscript files (.eps) via Python-turtle?](https://stackoverflow.com/questions/76022511/is-there-a-workaround-exporting-larger-postscript-files-eps-via-python-turtle) You are essentially asking the same question with some updates to your code based on the suggestions here. I think you should've updated this question instead of asking a new one. But now, we can only close this as a duplicate of your "follow up" question. – M-- Apr 15 '23 at 20:23

0 Answers0