Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with Turtle
#1
Hello guys, im trying to make something where i give 4 imputs that eventually has to read a excel file.
So the problem that im having is that the begin_fill() function doesnt work. I only get a "open" circle.
Here is my code
import turtle as t
t.speed(10000)
def drawOpenCircle(color,x,y,r):
    t.pencolor(color)
    t.down()
    for i in range(90):
        t.forward(2*3.1415*r/90)
        t.right(4)   
    t.done()

def drawFilledCircle(color,x,y,r):
    t.fillcolor(color)
    t.begin_fill()
    drawOpenCircle(color,x,y,r)
    t.end_fill()

drawFilledCircle('red',50,50,50)
My desired output is a filled circle.
Reply
#2
I think that when you call t.done() turtle stops to track what you wanted to fill.

import turtle as t
t.speed(10000)


def drawOpenCircle(color, x, y, r):
    t.pencolor(color)
    t.down()
    for i in range(90):
        t.forward(2 * 3.1415 * r / 90)
        t.right(4)


def drawFilledCircle(color, x, y, r):
    t.fillcolor(color)
    t.begin_fill()
    drawOpenCircle(color, x, y, r)
    t.end_fill()
    t.done()


drawFilledCircle('red', 50, 50, 50)
Reply
#3
Ohh wow Wall I spend an hour looking what I did wrong...
Thanks though man!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 6,127 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 5,540 Jan-04-2019, 02:44 AM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

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