teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

処理内容変更

2020/05/06 05:40

投稿

shiracamus
shiracamus

スコア5406

answer CHANGED
@@ -5,7 +5,6 @@
5
5
  import tkinter as tk
6
6
  import random
7
7
 
8
-
9
8
  # ウィンドウを作成
10
9
  win = tk.Tk()
11
10
  win.title("質問")
@@ -26,13 +25,12 @@
26
25
  value.set(random.randint(0, 100))
27
26
 
28
27
  def ok_click(event=None):
29
- if entry.get() != value.get():
28
+ if entry.get() == value.get():
30
- return
31
- global n
29
+ global n
32
- n = (n + 1) % len(q)
30
+ n = (n + 1) % len(q)
33
- question.set(q[n])
31
+ question.set(q[n])
32
+ entry.set("")
34
33
  value.set(random.randint(0, 100))
35
- entry.set("")
36
34
 
37
35
  # 部品を作成
38
36
  tk.Label(win, textvariable=question).pack()