def __present__(self, fragment, inheritedState): title = Label('Code stepper') header = _headerStyle( Row([ title.alignVCentre().alignHPack(), Pres.coerce(self._stepButton).alignHPack(), Pres.coerce(self._runButton).alignHPack() ])).alignHExpand() main = Column([header, Pres.coerce(self._code).alignHExpand()]) return _stepperBorder.surround(main).withCommands(_stepperCommands)
def _dropPrompt(varNameTextEntryListener): textEntry = TextEntry( 'var', varNameTextEntryListener ).regexValidated( _varNameRegex, 'Please enter a valid identifier' ) prompt = Label( 'Place object into a variable named: ' ) textEntry.grabCaretOnRealise() textEntry.selectAllOnRealise() return _dropPromptStyle.applyTo( Border( Paragraph( [ prompt.alignVCentre(), textEntry.alignVCentre() ] ).alignHPack() ) )