I'm trying to build a Tkinter that counts how many times a letter appears in the entry box. I want it so I enter letters A,B, or C into the entry box, and when I click 'Count' it displays how many times each letter appears. I feel like I'm really close but my update function isn't printing the correct number of counts, just 0 every time. Could someone help me out?
from Tkinter import *
window = Tk()
frame = Frame(window)
frame.pack()
var = StringVar()
entry = Entry(frame, textvariable=var)
entry.pack()
count = ()
def update():
A = 0
B = 0
C = 0
variable = entry.get()
for i in variable:
if i == A:
A = A + 1
if i == T:
B = B + 1
if i == C:
C = C + 1
count = ("Num As:%s Num Bs:%s Num Cs:%s" %(A,B,C))
frame2 = Label(frame, text=count)
frame2.pack()
button = Button(frame, text="Count", command=update)
button.pack()
window.mainloop()
Also, I'm still new to Python so I don't need to know how to cut corners, I just want my 'count' to display and update correctly :P Thanks!