This is a similar question so I think I'm in the right forum. I have a tkinter app that counts 'steps' for something. After about 2 billion +1 additions (close to the size of a maximum 32-bit int), the count displayed in an Entry widget stops being user accessible -- can't focus the cursor in the displayed value and can't select some or all the characters of the value. If I restart the app and preset ('Update') the count to 1999999999 before starting, it still take 2 billion steps or more for this problem to manifest. Below is a stripped down app that shows this problem on 64-bit Windows 10 and on a Raspberry Pi 4. (Original script was replaced. See comments. 17Jan2021)
from tkinter import * #python3
start = False
count = 0
def startCount():
global start
start = True
countUp()
def stopCount():
global start
start = False
eVal.set(count)
def get_eVal():
global count
count = int(eVal.get())
def countUp():
global count, start
count += 1
if count % 1000 == 0:
eVal.set(count)
if start:
on.after_idle(countUp)
root = Tk()
eVal = StringVar()
frame = Frame(root)
on = Button(frame, text='Start', command=startCount)
off = Button(frame, text='Stop', command=stopCount)
updt = Button(frame, text='Update', command=get_eVal)
entry = Entry(frame, textvariable=eVal, width=20, justify=RIGHT)
on.pack(side=LEFT)
off.pack(side=LEFT, padx=(8,4), pady=6)
updt.pack(side=LEFT, padx=(4,8))
entry.pack(side=LEFT)
frame.pack()
mainloop()
So far in my bigger app, when this problem happens, ALL Entry widgets become inaccessible to the user. Is this a known tkinter problem? Are there any easy fixes?