简体   繁体   English

使用Tkinter和Python提升图像

[英]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. 我正在使用Python与Tkinter,并想知道是否有人可以帮我这个。 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. 我创建图像的顺序无法更改,因此现在C位于A顶部的B顶部。

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? 有没有办法改变顺序 - 不改变我创建它们的顺序 - 这样B就在C之上,而且都在A之上? Perhaps there is some sort of attribute like B.Ontopof(C) ? 也许有某种属性如B.Ontopof(C)? Thanks for your help in advance. 感谢您的帮助。

canvas.tag_raise(item)

至少我认为......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM