I am trying to include several variables (a1 and a2) in my Text component. Each of these variables (numbers) is defined by user. So I have a code component which helps me to visualize the input.
Here is part of my code for a1 variable:
keys = event.getKeys() if len(keys): if 'space' in keys: a1.text = a1.text + ' ' elif 'backspace' in keys: a1.text = a1.text[:-1] elif 'lshift' in keys or 'rshift' in keys: modify = True else: if modify: a1.text = a1.text + keys.upper() modify = False else: a1.text = a1.text + keys
And I have a text component with my 2 variables:
$a1 + '\n' + a2
I get the following error:
a1.text = '' AttributeError: 'str' object has no attribute 'text'
How should I define my a1 and a2 variables?