Updating Lower case to Upper case char in Entry box

Changing lower case to Upper case and vice-versa

We will use string function upper() to change our string to Upper case chars. Similarly we can use lower() to change all upper case chars to lower.
We used StringVar() to track the changes in textvariable connected to Entry widget.

Tkinter Entry box data from lower case to Upper case and vice-versa as we type or instantly
import tkinter as tk
my_w = tk.Tk()
my_w.geometry("420x200")  # Size of the window 
my_w.title("www.plus2net.com")  # Adding a title

def my_upper(*args):
    str1.set(str1.get().upper()) # change to Upper case 
	
str1 = tk.StringVar(my_w) # declare StringVar()

e1 = tk.Entry(my_w,textvariable=str1,font=28,width=30,bg='yellow')  
e1.grid(row=0,column=1,pady=20,padx=10)

str1.trace('w',my_upper) # trigger when variable changes 

my_w.mainloop() 
Tkinter Entry Show Hide Password Using Checkbutton Tkinter Text How to Validate user entered data
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate 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.



Subscribe to our YouTube Channel here



plus2net.com



12-12-2022

Hi how are you
How to print hard copy of frame data in image format using tkinter python
And how to print Treeview data also

12-12-2022

Hi how are you
How to print hard copy of frame data in image format using tkinter python
And how to print Treeview data also




Python Video Tutorials
Python SQLite Video Tutorials
Python MySQL Video Tutorials
Python Tkinter Video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer