I have a while
loop that I want to run while the Tkinter window is open but the Tkinter window doesn't even open when the while
loop is running.
This is a problem since my while
loop is an infinite loop.
I basically want to create a programme that provides the users with new choices after a previous choice is selected by updating the buttons through a while
loop, but whenever I use a while
loop Tkinter doesn't open the window until I end the loop.
root = Tk()
i=0
while i==0:
def choice1():
list1[a1].implement()
list1.remove(list1[a1])
def choice2():
list2[a2].implement()
list2.remove(list2[a2])
button1 = tk.Button(root, text=list1.headline, command=choice1)
button2 = tk.Button(root, text=list2.headline, command =choice2)
root.mainloop()
Also, an error shows up because tkinter keeps executing this loop until there are no items in list1 or list2 left.
What I want to know is if there is a way to run Tkinter window while the while loop is going on
(a1
and a2
are randomly generated numbers.)