Is there a way of using .lower more effectively in tkinter?

0 votes

When asking the user for an input I would like it to be set to .lower() like in python when you do start=start.lower() for example. Is there any way I can do this in tkinter without putting Command_Line.get().lower every time due to my code having a code of inputs and me wanting to be efficient?

Sep 25, 2018 in Python by bug_seeker
• 14,970 points
73 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Here is a simple function and some example code that will modify the value of a string var to lower case. Just pass the stringvar to the function.

from tkinter import *

root = Tk()
#No need for the following line in your code
root.withdraw()


def lowerStringVar(var):
    """Function to convert the text in a StringVar to lower case"""
    if isinstance(var, StringVar):
        var.set(var.get().lower())

myTextVar = StringVar()
myTextVar.set("ALL UPPER CASE")
print(myTextVar.get())

lowerStringVar(myTextVar)

print(myTextVar.get())
answered Sep 25, 2018 by Priyaj
• 56,120 points

Related Questions In Python

0 votes
1 answer

Is there a way to list out in-built variables and functions of Python?

The in-built variables and functions are defined ...READ MORE

answered May 14 in Python by Junaid
6 views
0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,710 points
43 views
0 votes
1 answer

What is the recommended way to randomize a list of strings using Python?

Hi. Nice question. Here is the simplified answer ...READ MORE

answered Jan 18 in Python by Nymeria
• 3,500 points
30 views
0 votes
0 answers

is there a way to run android using python?

can you give a few sample projects ...READ MORE

Apr 22 in Python by Waseem
• 2,070 points
19 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
24 views
0 votes
1 answer

Is there a label/goto in Python?

No, Python does not support labels and ...READ MORE

answered Aug 1, 2018 in Python by Priyaj
• 56,120 points
83 views
0 votes
1 answer

What is the meaning of “int(a[::-1])” in Python?

Assumming a is a string. The Slice ...READ MORE

answered Aug 27, 2018 in Python by Priyaj
• 56,120 points
49 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.