5

Does exist a way to specificate the depth of an element of the Tkinter canvas, like the HTML's z-index?

Currently the only way I found to let the element overlap as I want is to create it in a specific order; the problem is that some element must be created after Others, but they also should have a lower z-index.

Thanks in advance for the help!

L'ultimo
  • 521
  • 1
  • 5
  • 17
  • ~~I don't think so, but all tkinter widgets have a `tkraise()` method to bring them to the top, so you could create all your widgets and then raise them in the correct order.~~ Edit: Oh nm; I missed that you are working with elements on a canvas. – Novel Jun 26 '17 at 16:15
  • https://stackoverflow.com/questions/30429459/lift-and-raise-a-canvas-over-a-canvas-in-tkinter – Billal Begueradj Jun 26 '17 at 16:15

1 Answers1

6

Yes, all elements on a canvas are in a stacking order. They can be manipulated with the tag_raise and tag_lower methods.

For a rudimentary layering system see https://stackoverflow.com/a/9576938/7432

codester_09
  • 5,622
  • 2
  • 5
  • 27
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685