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)
var = StringVar()
entry = Entry(frame, textvariable=var)

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)
button = Button(frame, text="Count", command=update)


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!

I was supposed to set

if i is 'A'
if i == A

Dumb mistake...thanks anyway.

This question has already been answered. Start a new discussion instead.