I'm trying to make a simple GUI. The iron, gold, diamond, and emerald variables increase at specific times. I want to have my while loop going while my tkinter main loop goes. Any help will be appreciated. Thanks!
I got to this but I the iron label won't update.
import tkinter as tk
second=0
diamonds=0
#Team One Variables
i=0
g=0
d=0
e=0
teamOneHasEmeralds=False
#Team Two Variables
i2=0
g2=0
d2=0
e2=0
teamTwoHasEmeralds=False
#Setting Up Screen
root=tk.Tk()
root.title("Bedwars")
#screen = tk.Frame(root)
#screen.pack()
#Labels
iron = tk.Label(root, text=i)
def main():
global i
global i2
global second
i+=1
i2+=1
second+=1
print("Team One Iron=",i)
print("Team Two Iron=",i2)
root.after(1000, main)
iron.pack()
root.mainloop()
if second%3 == 0:
global g
global g2
g+=1
g2+=1
print("Team One Gold=",g)
print("Team Two Gold=",g2)
if second%20==0:
global diamonds
if diamonds < 5:
diamonds+=1
print("Diamonds=",diamonds)
if teamOneHasEmeralds and second%25==0:
global e
e+=1
print("Team One Emeralds=",e)
if teamTwoHasEmeralds and second%25==0:
global e2
e2+=1
print("Team Two Emeralds=",e2)
root.after(1000, main)
root.mainloop()