from zope.schema import Choice class GenderSchema(Interface): gender = Choice(title=u'Gender', values=('Male', 'Female', 'Other'))
from zope.schema import Choice from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm class ColorSchema(Interface): color = Choice(title=u'Color', vocabulary=SimpleVocabulary([ SimpleTerm(value=u'red', title=u'Red'), SimpleTerm(value=u'green', title=u'Green'), SimpleTerm(value=u'blue', title=u'Blue') ]))In this example, we define a ColorSchema with a Choice field named color that allows the user to choose from a vocabulary of three colors: "Red", "Green", and "Blue". The package library for this example is zope.schema.