Example #1
0
 def __init__(self, parent, owner, name, **options):
     super(ScaleManager, self).__init__(parent, owner, name, IntVar)
     trait = get_trait_by_name(owner, name)
     if hasattr(trait, '_low') and 'from_' not in options:
         options['from_'] = trait._low
     if hasattr(trait, '_high') and 'to' not in options:
         options['to'] = trait._high
     self.scale = Scale(
         parent,
         variable=self.tk_variable,
         **options
     )
Example #2
0
 def __init__(self, parent, owner, name, **options):
     super(SpinboxManager, self).__init__(parent, owner, name, IntVar)
     trait = get_trait_by_name(owner, name)
     if 'from_' not in options:
         low = getattr(trait, '_low', None)
         if low is not None:
             options['from_'] = low
     if 'to' not in options:
         high = getattr(trait, '_high', None)
         if high is not None:
             options['to'] = high
     if 'width' not in options:
         options['width'] = max(
             len(str(options.get('from_', 0))),
             len(str(options.get('to', sys.maxint)))
         )
     self.spinbox = Spinbox(
         parent,
         textvariable=self.tk_variable,
         **options
     )