Oct-27-2020, 09:36 PM
The only reasons for giving widgets names is so you can reference them in a style sheet or you used a designer to make your panels. Otherwise you should create structure to organize your widgets to make them easy to use.
I do not like building strings using "+" and now use f'strings. In your code I would replace
I do not like building strings using "+" and now use f'strings. In your code I would replace
string = 'FormulationName' + cb.objectName()[11:] code_string = 'self.' + string + '.text()'with this:
code_string = f'self.FormulationName{cb.objectName()[11:]}.text()'