Python Forum
setup() from turtle module not working
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
setup() from turtle module not working
#1
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.
Reply
#2
(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,
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply
#3
Hi,

In fact, it doesn't give any kind of errors, the code runs OK, but simply not resizing the window.
Reply
#4
(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,
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply
#5
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!
Reply
#6
(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,
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply
#7
Thank you very much for your help.
Reply
#8
(Oct-28-2019, 10:51 AM)bobfat Wrote: Thank you very much for your help.

You're welcome! Smile
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  working with TLV module Object Jennifer_Jone 3 1,075 Mar-14-2023, 07:54 PM
Last Post: Jennifer_Jone
  Unsure why module is not working garynewport 0 735 Feb-15-2023, 03:21 PM
Last Post: garynewport
  Pandas module not working Hass 2 1,669 Apr-14-2022, 03:13 PM
Last Post: snippsat
  Setup working directory in IDLE Pavel_47 3 3,669 Mar-06-2021, 08:59 AM
Last Post: Pavel_47
  Noob question: why is shapesize() not working for my turtle adifrank 8 5,662 Sep-09-2020, 11:13 PM
Last Post: adifrank
  importing module - not working jdhamblett 3 2,945 Jun-22-2020, 07:33 PM
Last Post: jdhamblett
  turtle.Screen() not working Jdawgg531 0 2,694 May-04-2020, 12:43 AM
Last Post: Jdawgg531
  pyinstaller not working with acoustics module pynz 2 2,713 Oct-08-2019, 07:56 AM
Last Post: pynz
  cx_freeze setup.py error: No module __SNMP-FRAMEWORK-MIB nacho 8 8,853 Jul-26-2019, 09:33 PM
Last Post: njmatt415
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 6,124 Feb-06-2019, 01:25 AM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020