确定两个 tkinter 画布项目中哪一个位于另一个之上
有没有办法根据各自的 id 确定哪个项目在 tkinter 画布的显示顺序上位于最上面?
Is there a way to determine which item is topmost on the displaying order of a tkinter
canvas given their respective id's?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用canvas.find_all()来获取所有项目ID,并根据文档:“项目按堆叠顺序返回,最低的项目在前”。
下面是查找检查列表中最上面的项目的示例:
You can use
canvas.find_all()
to get all the item IDs and according to the document: "The items are returned in stacking order, with the lowest item first".Below is an example to find the topmost item in a check list: