O'Reilly logo

Sage Beginner's Guide by Craig Finch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - making interactive controls

This example consists of a gallery of all the basic controls that can be used in the Sage notebook interface. The code is followed by the result from running that code in an input cell.

@interact
def _(t=text_control('Static text goes here')):
	pass
Time for action - making interactive controls
@interact
def _(value = slider(vmin=0, vmax=10, step_size=1, default=5,
	label='Slide me:', display_value = True)):
	print value
Time for action - making interactive controls

Here is a shorthand way to create the same type of control:

 @interact # Shortcuts def _(value1=(1..10), value2=(0,100,10), value3=(1,10)): ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required