![](/img/trans.png)
[英]How do I get mouse position relative to the parent widget in tkinter?
[英]How do I get a widget position in tkinter?
我想要一個小部件向前或向后移動。
#I tried doing this other thing called winfo_rootx for tkinter but
#it just outputted this.
>>> import tkinter
>>> tkinter.winfo_rootx()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tkinter' has no attribute 'winfo_rootx'
>>>
您想使用小部件的winfo_x
和winfo_y
方法來獲取其 x/y position 相對於其父 window(幀)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.