Radio button group name

What I’m trying to do:
When a radio button belonging to lets say radio_group1 is selected I would like to save the group name into a table
What I’ve tried and what’s not working:
I have been trying to just print the group name in an attempt to break what I’m actualy trying to do into smaller bites.

 hobbies_selected_group = (self.radio_button_1.group_name())
      print(hobbies_selected_group)

but I get this error

TypeError: ‘str’ object is not callable at [hobbies, line 36](javascript:void(0)) called from [hobbies, line 18](javascript:void(0))

try:

hobbies_selected_group = self.radio_button_1.group_name
print(hobbies_selected_group)

The error message is telling you that, by including those brackets, you’re attempting to call group_name. However, because it’s a property, rather than a callable method, that’s not possible.

Instead, you can just access the value (a str object) of that property as shown.

2 Likes

I have found a solution to this

Thanks Owen

I managed to find a solution to what I was trying to accomplish