Python Forum
setup() from turtle module not working - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: setup() from turtle module not working (/thread-22061.html)



setup() from turtle module not working - bobfat - Oct-27-2019

Hello,

I am trying to make changes in the turtle graphics window size. I tried using the screensize() and the setup() methods, but no success. The latest code was very simple:
from turtle import *
setup(600,500)
for i in range(7):
    forward(50)
    left(90)
    forward(50)
    right(90)
I have updated my Python version to 3.8 and running under Windows 8.1 pro. I tried everything.... It doesn't work. Thank you for your help.


RE: setup() from turtle module not working - newbieAuggie2019 - Oct-27-2019

(Oct-27-2019, 09:13 PM)bobfat Wrote: I have updated my Python version to 3.8 and running under Windows 8.1 pro. I tried everything.... It doesn't work. Thank you for your help.

Hi!

I ran your program on my Python 3.7.4 Shell and Windows 10, and it runs without any problems.

Did you check if it ran without any problems before updating your Python version to 3.8?

I've read here, on this site, that some people are having some trouble running some modules with Python 3.8. That may be also your case.

All the best,


RE: setup() from turtle module not working - bobfat - Oct-27-2019

Hi,

In fact, it doesn't give any kind of errors, the code runs OK, but simply not resizing the window.


RE: setup() from turtle module not working - newbieAuggie2019 - Oct-28-2019

(Oct-27-2019, 11:20 PM)bobfat Wrote: In fact, it doesn't give any kind of errors, the code runs OK, but simply not resizing the window.

Then, if you run this modification of your program, you can see if the window size really changes or not:

from turtle import *
setup(600,500)
for i in range(7):
    forward(50)
    left(90)
    forward(50)
    right(90)
setup(200,100)
for i in range(7):
    forward(50)
    left(90)
    forward(50)
    right(90)
All the best,


RE: setup() from turtle module not working - bobfat - Oct-28-2019

While I am testing, I tried the same code but I replaced the setup() method value: instead of using dimensions in pixels, I used percentage:
from turtle import *
setup(0.75,0.95)
for i in range(7):
    forward(50)
    left(90)
    forward(50)
    right(90)
I worked just fine. It solves the problem but I can't understand why it doesn't work when I use pixels.

Thank you very much!


RE: setup() from turtle module not working - newbieAuggie2019 - Oct-28-2019

(Oct-28-2019, 12:03 AM)bobfat Wrote: I tried the same code but [ ... ] instead of using dimensions in pixels, I used percentage:
from turtle import *
setup(0.75,0.95)
[ ... ] I can't understand why it doesn't work when I use pixels.

My understanding is that you are trying to set the dimensions of the window to less than a pixel per side, so I think there is a minimum default size of the turtle window.

All the best,


RE: setup() from turtle module not working - bobfat - Oct-28-2019

Thank you very much for your help.


RE: setup() from turtle module not working - newbieAuggie2019 - Oct-28-2019

(Oct-28-2019, 10:51 AM)bobfat Wrote: Thank you very much for your help.

You're welcome! Smile