joanca, frederik, thanks for your fast answers!
joancas suggestion works. Though I read often that
exec()
might be dangerous to use. Unfortunately I get an NameError with frederiks variant:
NameError: global name 'Checkbox' is not defined
This is my current code:
from vanilla import *
class setOrganizer():
def __init__(self):
self.w = Window((400,400), 'checkBoxWindow')
for i in range(10):
checkboxObject = Checkbox((10, 10, 10+30*i, 22), "label %s" % i)
setattr(self.w, "checkBox_%s" % i, checkboxObject)
self.w.open()
setOrganizer()