Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #好用工具 測量tk 視窗大小
- #https://bit.ly/3lhYW8h
- import tkinter as tk
- def go():
- txt = '視窗左上角座標為:({},{})\n 視窗高度為:{} 視窗寬度為:{}'.format(
- root.winfo_x(), root.winfo_y(), root.winfo_height(), root.winfo_width())
- label1.configure(text=txt)
- root.after(1, go)
- root = tk.Tk()
- root.geometry("400x200+100+50")
- label1 = tk.Label(root)
- label1.pack()
- go()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement