Oct-19-2020, 11:35 AM
(Oct-19-2020, 03:27 AM)buran Wrote: Look at getattr() built-in function.
Note that with attribute name like method1, method2, etc. there is good chance you are doing something the wrong way. Better tell us what/why you are doing this and what's your code, i.e. instead of 40 methods 2 or 3 will be sufficient to demonstrate your case.
getattr may do the job, basically I got 40 Custom GraphviewWidget that are in a ui class for diaplaying resources of a n servers (CPU, RAM, load average, I/O, etc..). All these are embedded in a TabWidget, and i have to display Server_Name_Resource_method in each tab.
Design is probably not best but simple :)
Thanks anyway for your answers, will test getattr at once.