-1

For example:

from tkinter import *

root = Tk()
root.state=("zoomed")
counter = 0
word = ("Placeholder")

lbl_point = Label(root, text="Points: " + counter
lbl_point.pack

txt_guess = Entry(root, text="You're guess?")
txt_guess.pack(side=TOP)

if txt_guess.get() == word:
 counter = counter + 1
 print("debug" + counter)
else:
 print("placeholder incorrect")

root.mainloop()

The label "lbl_point" doesn't update when "counter" changes numbers. I've tried adding root.update_idletasks() at the end of "if txt_guess.get() == word but it didn't change anything.

Any help is appreciated.

Xendex
  • 19
  • 6
  • Does this answer your question? [Making python/tkinter label widget update?](https://stackoverflow.com/questions/1918005/making-python-tkinter-label-widget-update) – stovfl Apr 18 '20 at 21:11
  • 2
    First you have to understand [Event-driven_programming](https://en.m.wikipedia.org/wiki/Event-driven_programming). Read through [`[tkinter] event driven programming`](https://stackoverflow.com/search?q=is%3Aanswer+%5Btkinter%5D+event+driven+programming+entry) – stovfl Apr 18 '20 at 21:13
  • Been a long time but I finally read through event-driver programming and I see where I went wrong. Thanks. – Xendex Oct 06 '22 at 01:20

1 Answers1

0

try this solution:

lbl_point.configure(text="Points: " + counter)
rn0mandap
  • 333
  • 1
  • 8