True機能で追加した後、tkinterウィンドウが開かない。これをどのように機能させることができますか?真実がなくても動作しますが、私の機能にはそれが必要です。あなたが持っていた2つのエラーTkinterウィンドウが開かれていない
from tkinter import *
from random import random
import sys
import random
maxcount = int (input("How many times "))
i = 1
cats = Tk()
cats.wm_title("maxcount test")
cats.geometry("500x500")
def black():
while True:
i+1
if i == 5:
break
Button(cats, text="Start", command=black()).grid(row=1, column=0)
Label(cats, text="How many times:").grid(row=0, column=0)
cats.mainloop()
あなたは 'while'ループを持っている必要があります理由はありますか?あなたがやっていることは、変数を5に設定しているだけです。これには、whileループを行う必要はありません。 'while'ループを必要としているものがありますか? –