回答編集履歴

1

Update

2022/03/03 07:15

投稿

melian
melian

スコア21163

test CHANGED
@@ -1,12 +1,24 @@
1
- `update()` を実行します(flush同じ効果)。
1
+ `update()` を使いますが、create and destroy ではなく `pack()` `pack_forget()` を使ってみてはどうでしょうか
2
2
  ```python
3
+ import tkinter as tk
4
+
5
+ def RegularCheck():
6
+ if label1.winfo_ismapped():
7
+ label1.pack_forget()
8
+ else:
3
- label1.place(
9
+ label1.pack()
4
- x = 0,
5
- y = 0
6
- )
7
- label1.update()
10
+ label1.update()
8
- time.sleep(1)
9
- label1.destroy()
10
- root.after(1000,RegularCheck)
11
+ root.after(1000, RegularCheck)
12
+
13
+ if __name__ == '__main__':
14
+ root =tk.Tk()
15
+
16
+ label1 = tk.Label(
17
+ root, text="Text on the screen", font=('Times New Roman', '80'),
18
+ fg="black", bg="white")
19
+ label1.place(x = 0, y = 0)
20
+
21
+ RegularCheck()
22
+ root.mainloop()
11
23
  ```
12
24