Home > Software engineering >  Turtle Graphics displaying pixelated graphics
Turtle Graphics displaying pixelated graphics

Time:10-20

I created a random spot painting generator program as part of the course that I'm following. My code involves using the turtle.dot() function to create dots anywhere the turtle goes. The actual logic seems to work fine but it's creating pixelated dots, as in, blurred images.

The course videos have perfect outputs - exactly how circles should be.

I switched from VSCode to PyCharm but that didn't help. I also created a bunch of other Turtle Graphics programs - Spirograph generators, Random walk and none of them produce sharp objects on screen, as you'd expect from a 21st century machine.

I cannot figure out what the issue is. Is it the code? display drivers? or some bug?

Here's the code:

import turtle
turtle.colormode(255)

t = turtle.Turtle()
s = turtle.Screen()
t.penup()
t.speed(0)
t.setpos(-200, -200)

for m in range(10):
    for n in range(10):
        t.dot(20, 'red')
        t.forward(50)
    t.setx(-200)
    t.sety(t.ycor() 50)

s.exitonclick()

Notice how the spots look like polygons and not, circles:

Notice how the spots look like polygons and not, circles.

CodePudding user response:

I'm pretty sure that you should be using something other than python turtle if you want RTX level graphics. That's just how turtle is, it was made to be like the first robot ever invented. named a turtle. http://cyberneticzoo.com/cyberneticanimals/1969-the-logo-turtle-seymour-papert-marvin-minsky-et-al-american/

CodePudding user response:

One thing that you could try though is turtle.shape() and turtle.stamp() like this:

import turtle
turtle.colormode(255)

t = turtle.Turtle()
s = turtle.Screen()
t.penup()
t.speed(0)
t.setpos(-200, -200)

for m in range(10):
    for n in range(10):
        t.shape("circle")
        t.stamp()
        t.forward(50)
    t.setx(-200)
    t.sety(t.ycor() 50)


s.exitonclick()

Its not perfect but you can figure it out.

  • Related