File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -765,18 +765,23 @@ def _widgets(self):
765765 if not self ._widgets_ :
766766 widget_classes = OrderedDict ()
767767 for k in self ._category_classes .iterkeys ():
768- widget_classes [k ] = widgets .HBox ()
769-
768+ box = widgets .HBox ()
769+ box .layout .display = 'flex-flow'
770+ widget_classes [k ] = box
770771 def oc (cat ):
771772 def on_change (name , value ):
772773 self .toggle_category (cat , value )
773774 self .show ()
774775
775776 return on_change
776777
778+
779+ width = self ._find_button_width ()
780+
777781 for each in self ._categories :
778782 w = widgets .ToggleButton ()
779783 w .description = each
784+ w .width = width
780785 w .value = self .categories_status [each ]
781786 on_change = oc (each )
782787 w .on_trait_change (on_change , 'value' )
@@ -1113,3 +1118,12 @@ def adjust_figure(self):
11131118 display (self ._save_button )
11141119 # self._save_button.remove_class('vbox')
11151120 # self._save_button.add_class('hbox')
1121+
1122+ def _find_button_width (self ):
1123+ longest = sorted ([len (each ) for each in self ._categories ])[- 1 ]
1124+ if longest > 14 :
1125+ width_px = (longest - 14 ) * 5 + 145
1126+ width = str (width_px ) + 'px'
1127+ else :
1128+ width = '145px'
1129+ return width
You can’t perform that action at this time.
0 commit comments