I really don't know Tkinter very well, I'm not even sure this is possible to do. But basically I want a visual representation of the score the user gets in the game i've programmed. As it works currently, the user gets to choose between "study" and "party", and depending on how he answers the tamaguchi either increases in size or decreases. The idea is that the tamaguchi is represented in Tkinter by a circle that corresponds with the score the user gets. I was thinking maybe I can have this in the root.mainloop()? So each time it goes through the loop, it deletes the last circle, and creates a new one with the updated score. This is what i've written so far:
class Application(Frame):
def __init__(self,master):
super(Application,self).__init__(master)
self.grid()
self.create_widgets()
self.circle()
def circle(self):
circle1.destroy()
r = int(tamaguchin.size)
self.circle1 = circle(r^2*3.14)
self.circle1.grid()
def create_widgets(self):
Label(self,
text = "Välkommen till spelet!"
).grid(row = 0, column = 6, sticky = W)
self.btn1 = Button(self, text = "study", command = lambda:self.update_text('plugga'))
self.btn1.grid(row=1,column=0)
self.btn2 = Button(self, text = "party", command = lambda:self.update_text('festa'))
self.btn2.grid(row=2,column=0)
self.btn3 = Button(self, text = "exit", command = self.exit)
self.btn5.grid()
def update_text(self,value):
message = "Your choice was",value,"which brings your last 3 choices to:"
print(message)
lista.append(value)
lista.remove(lista[0])
print(lista[0],'-',lista[1],'-',lista[2])
if lista in PositivLista:
tamaguchin.increasesize()
elif lista in NegativLista:
tamaguchin.decreasesize()
elif lista in HalveringsLista:
tamaguchin.halfsize()
else:
tamaguchin.samesize()
return lista
def exit(self):
print('You have chosen to exit the game')
root.destroy()
root = Tk()
root.title("Tamaguchi-game")
root.geometry("500x500")
app = Application(root)
app.grid()
root.mainloop()
I don't know if there's some sort of in-built function that can help me with this, but I haven't been able to find anything yet on my own. Of course my idea could be (and likely is) not very good so if anyone has a better idea on how to approach it, i'm all open; I'm a pretty big noob =] Thanks a lot for any help, i'm really stuck with this!