0

I've drawn two objects in Python turtle, when the second object draws on screen, it comes in front of the first object and hides it. I don't want that, I want the first object to come in front. How can I do that?

Ali Danish
  • 15
  • 3

2 Answers2

0

You could gather your objects into a list and draw them in reverse order:

a = [ ... ] # objects that respond to draw
for i in reversed(a):
    i.draw()
quamrana
  • 37,849
  • 12
  • 53
  • 71
0

The rule when it comes to two turtle objects at the same location is: last to arrive is on top

There are (random) exceptions, see my answer to Make One Turtle Object Always Above Another.

these are actually two images.

Assuming your images are turtles, via turtle.register_shape() (or its alias) and turtle.shape(), then you may be able to force the rear image/turtle to the front, even if drawn first, by making it do some sort of null motion, eg. turtle.forward(0), forcing it to arrive later.

cdlane
  • 40,441
  • 5
  • 32
  • 81