2024-10-02 10:28:26 发布
网友
有没有一个快速的方法来访问我放置的某个小工具的位置。在
例如,如果我有一个按钮
self.exampleButton = tk.Button(self) self.exampleButton.grid(row=3,column=0,sticky="EW")
有没有办法我可以得到行或列?像self.exampleButton.getPosition之类的?在
self.exampleButton.getPosition
创建一个字典来存储信息,比如{self.exampleButton:(3,0)},是最好的方法吗?在
{self.exampleButton:(3,0)}
Tkinter有一个方便的grid_info()函数:
grid_info()
info = exampleButton.grid_info() print((info["row"], info["column"]))
Tkinter有一个方便的
grid_info()
函数:相关问题 更多 >
编程相关推荐