Reputation: 1084
I have name of class in string like:
conf[0] = 'smtp_config'
and i want to run method like:
self.ui.smtp_config.setText("....")
How can i do this in python? :)
Upvotes: 2
Views: 163
Reputation: 116307
func = getattr(self.ui, conf[0]) func.setText("....")
Reputation: 46657
Try getattr(self.ui,conf[0]).setText(...)
getattr(self.ui,conf[0]).setText(...)
Upvotes: 3