Category : python-turtle

I want to save a turtle drawing to and .eps file. Right now I use the function screen.getcanvas().postscript(file="test.eps") The problem with that is it doesn’t save the complete drawing. Before I draw, I don’t know how big the drawing will be. When I drew, I have the biggest x and y value. The function like ..

Read more

I keep getting this error AttributeError: ‘int’ object has no attribute ‘goto’ it hapens when the tower trys to shoot and sorry its a bit of a mess`#tower s=turtle.Turtle() s.shape(‘circle’) s.penup() s.goto(-140,-70) b=turtle.Turtle() b.hideturtle() def shoot(): a=s.ycor()+100 b=s.ycor()-100 c=s.xcor()+100 d=s.xcor()-100 o=e.ycor() f=e.xcor() j=s.xcor() v=s.ycor() if o<=a and f<=c: sy=s.ycor() sx=s.xcor() ey=e.ycor() ex=e.xcor() b.goto(j,v) s.forward(0) b.showturtle() ..

Read more

I am a beginner programmer, sorry if the answer is obvious. Any help is appreciated. I am currently using WIN.onkeypress() to call functions but my scroll_draw_col function requires the argument curr_draw_col. I know WIN.onkeypress() can’t pass arguments to their function. How do I call the scroll_draw_col function with curr_draw_col as an argument on keypress ("f")? ..

Read more

You decide to keep track of the number of pizzas sold for each type every day with a stacked bar chart. Use the turtle module to draw the bar chart with the following requirements: Each bar includes four rectangles representing the number of pizzas sold for each type. From bottom to top, they are large ..

Read more

I am trying to build a game where a ship should shoot some stuff, I am trying to get the ship position and pass it to the function that generate the shot, but I can’t do this, I tried the below methods: ship.py def __init__(self): super().__init__() self.ship = Turtle(shape=’turtle’) self.ship.penup() self.ship.color(‘white’) self.ship.goto(0, -250) self.ship.left(90) self.x ..

Read more