Bottom Page

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.
Quote
#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
Quote
#3
Hi,

In fact, it doesn't give any kind of errors, the code runs OK, but simply not resizing the window.
Quote
#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
Quote
#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!
Quote
#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
Quote
#7
Thank you very much for your help.
Quote
#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
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  pyinstaller not working with acoustics module pynz 2 243 Oct-08-2019, 07:56 AM
Last Post: pynz
  cx_freeze setup.py error: No module __SNMP-FRAMEWORK-MIB nacho 8 3,220 Jul-26-2019, 09:33 PM
Last Post: njmatt415
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 1,652 Feb-06-2019, 01:25 AM
Last Post: woooee
  Help! Turtle not working, even when we click the turtle demo in IDLE nothing happens. BertyBee 3 724 Jan-04-2019, 02:44 AM
Last Post: SheeppOSU
  import keyboard module doesn't get found - working on laptop but no on raspberry pi.. HANSJORG2 1 2,493 Mar-16-2018, 02:48 PM
Last Post: sparkz_alot
  Working with turtle graphics in python and colour slices of a pie graph... netrate 1 1,179 Feb-03-2018, 08:41 PM
Last Post: Larz60+
  turtle module kalamarovskycom 1 1,028 Jan-22-2018, 06:27 PM
Last Post: Gribouillis
  Logging module stopped working! llanitedave 1 2,187 Oct-18-2017, 06:45 AM
Last Post: llanitedave
  python turtle module in pycharm error sajley 2 7,066 Dec-12-2016, 08:52 PM
Last Post: sajley

Forum Jump:


Users browsing this thread: 1 Guest(s)