import locale
Here is the code to format the input as entered by user and on lost focus or once the focus is moved out of the input box the data is formatted. The required format can be changed based by using setlocal().
locale.setlocale(locale.LC_ALL, 'en_US.utf8')# USA
def show_format(*args):
e1_str.set(locale.format_string("%.2f", float(e1.get()), grouping=True))
Here e1_str is the string variable connected to entry option. So we used set() option of string variable to assign value to entry box.
e1.bind("<FocusOut>",show_format) # when tab is pressed
#e1.bind("<KeyRelease>",show_format) # when key is released
#locale.setlocale(locale.LC_ALL, 'de_DE.utf8')# German

locale.setlocale(locale.LC_ALL, 'en_US.utf8')# USA

e1_str.set("{:,}".format(int(e1.get())))
Full code is here
import tkinter as tk
import locale
#locale.setlocale(locale.LC_ALL, 'de_DE.utf8')# German
locale.setlocale(locale.LC_ALL, 'en_US.utf8')# USA
my_w = tk.Tk()
my_w.geometry("250x100")
font1=('Times',18,'bold')
sv = tk.StringVar() # String variable
def show_format(*args):
#e1_str.set("{:,}".format(int(e1.get())))
e1_str.set(locale.format_string("%.2f", float(e1.get()), grouping=True))
e1_str=tk.StringVar() # string variable
e1 = tk.Entry(my_w,font=font1,width=13,textvariable=e1_str)
e1.grid(row=1,column=1,padx=18,pady=5)
b1=tk.Button(my_w,text='Testing')
b1.grid(row=1,column=2)
e1.bind("<FocusOut>",show_format) # when tab is pressed
my_w.mainloop() # Keep the window open
We can use on key release event and then format every 4th position. Check how the cursor position is collected and repositioned. 
from tkinter import *
import tkinter as tk
my_w = tk.Tk()
my_w.geometry("350x100")
font1=('Times',18,'bold')
sv = tk.StringVar() # String varible
def show_format(*args):
position = e1.index(INSERT) # getting cursor position
if((position % 4)==0):
e1.icursor(position+1) # shift cursor one position
x=e1_str.get().replace(',','')
e1_str.set("{:,}".format(float(x)))
e1_str=tk.StringVar() # string variable
e1 = tk.Entry(my_w,font=font1,width=20,textvariable=e1_str)
e1.grid(row=1,column=1,padx=18,pady=5)
#e1.bind("<FocusOut>",show_format) # when tab is pressed
e1.bind("<KeyRelease>",show_format) # when key is released
my_w.mainloop() # Keep the window open
Tkinter Entry
Tkinter Text
How to Validate user entered data
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.