Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raising Image with Tkinter and Python

I have several images that I want to layer in a different order, than the order in which they were created. I am using Python with Tkinter and was wondering if someone could help me with this. The order that I create the images is:

#Using Tkinter
image1 = PhotoImage(file = "imageA.gif")
image2 = PhotoImage(file = "imageB.gif")
image3 = PhotoImage(file = "imageC.gif")
A = canvas.create_image(X,Y,image=image1)
B = canvas.create_image(X,Y,image=image2)
C = canvas.create_image(X,Y,image=image3)

The order in which I create the images cannot be changed, so as of right now C is on top of B which is on top of A.

Is there a way to change the order - without changing the order that I create them - so that B is on top of C, and both on top of A? Perhaps there is some sort of attribute like B.Ontopof(C) ? Thanks for your help in advance.

like image 578
ben Avatar asked Jun 04 '26 15:06

ben


1 Answers

canvas.tag_raise(item)

at least I think ...

like image 106
Joran Beasley Avatar answered Jun 06 '26 05:06

Joran Beasley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!