回答編集履歴

1

追記

2019/06/01 08:00

投稿

can110
can110

スコア38266

test CHANGED
@@ -59,3 +59,53 @@
59
59
  root.mainloop()
60
60
 
61
61
  ```
62
+
63
+
64
+
65
+ コメントを受けて
66
+
67
+ --
68
+
69
+ ウインドウの外側でもマウス座標を更新するためにはタイマーを使えばよいです。
70
+
71
+ ```Python
72
+
73
+ import pyautogui
74
+
75
+ import tkinter as tk
76
+
77
+
78
+
79
+ def timer():
80
+
81
+ px,py = pyautogui.position()
82
+
83
+ label['text'] = '{},{}'.format(px,py)
84
+
85
+ root.after(10, timer)
86
+
87
+
88
+
89
+ root = tk.Tk()
90
+
91
+ root.title("Tkinter test")
92
+
93
+ root.geometry("360x480")
94
+
95
+
96
+
97
+ label = tk.Label(root)
98
+
99
+ label.place(x=10, y=10)
100
+
101
+ label.update()
102
+
103
+
104
+
105
+ timer() # ***
106
+
107
+
108
+
109
+ root.mainloop()
110
+
111
+ ```