Mein Tkinter-Fenster nicht geöffnet, nachdem ich hinzufügen, während wahre Funktion. Wie kann ich das zur Arbeit bringen? Es funktioniert ohne wahr zu sein, aber ich brauche es in meiner Funktion.Tkinter-Fenster nicht geöffnet
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()
Gibt es einen Grund, warum Sie die 'while' Schleife haben müssen? Im Moment ist alles, was Sie tun, eine Variable auf 5 zu setzen, das braucht * keine 'while'-Schleife zu tun. Gibt es etwas, das du weglässt, was die 'while' Schleife notwendig macht? –