Modifying the user input in a textbox

What I’m trying to do:
I have textboxes inside a form to collect user inputs. One of them is named: ‘text_box_street’. User is supposed to enter the street as all uppercase, However, we all know that typing mistakes do happen. Now, I like to make sure that the user input is all uppercase by ‘coercing’ the input into uppercase.

What I’ve tried and what’s not working:

So, the textbox is bound with the ‘pressed_enter’ event handler.
This function is called when pressed:

def text_box_street_pressed_enter(self, **event_args):
        street_input=self.text_box_street.text

To convert the input into all uppercase (in case not), I added the following 2 lines to the above function:

street_input = street_input.upper()
print (street_input)

Result:

Nothing is printed on the console. The upper case change does not occur. Something odd I noticed at the outset. All event handlers were active even though I did not manually activated them so I deleted all except the pressed_enter event handler. Still, nothing worked.

Anything missing in what I did? It seems to be a simple issue but I am flummoxed. Would appreciate how I can get around this issue.

Much thanks.

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 

Clone link:
share a copy of your app

Set a self.street_input = “” below your props but ahead of the init, then refer to self.street_input at the other points in your code.

Hi, I tried your suggestion but it did not work.

I tried a few other approaches and finally found a way that worked. Instead of using the event handler ‘pressed enter’, I used the ‘change’ handler.

Here are the codes that worked for my street and town text boxes:

  def box_town_change(self, **event_args):
    self.box_town.text = self.box_town.text.upper()

  def box_street_change(self, **event_args):
    self.box_street.text = self.box_street.text .upper()

With the above codes, no matter what the user inputs on the text boxes, the text is automatically converted to uppercase.

Thanks.