Advertisement
Guest User

Untitled

a guest
Sep 19th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. def create_buttons(*buttons):
  2.     radio_fields = []
  3.     for button_name, button_choices in buttons:
  4.         field = RadioField(button_name, choices=button_choices)
  5.         radio_fields.append(field)
  6.     return radio_fields
  7.  
  8.  
  9. buttons_data = [
  10.     # (button_name, button_choices)
  11.     ('button1', [('name1', 'val'), ('name2', 'val')]),
  12.     ('button2', [('name1', 'val'), ('name2', 'val')]),
  13.     ('button3', [('name1', 'val'), ('name2', 'val')]),
  14.  
  15. ]
  16.  
  17. buttons = create_buttons(buttons_data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement