Updating Lower case to Upper case char in Entry box

Tkinter Entry

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
Subscribe to our YouTube Channel here

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    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 FORUM . Contact us
    ©2000-2022 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer