Skip to content

Commit

Permalink
Add a callback function update().
Browse files Browse the repository at this point in the history
  • Loading branch information
arabindo committed Apr 8, 2020
1 parent da0e2a5 commit 0ef1a24
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion str.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,21 @@

#set up widgets
velocity = Slider(title="velocity", value=200000, start=-29999999, end=29999999, step=500)
x_ra = Slider(title="X Range", value=xd, start=100, end=100000, step = 100)


#set up call back
def update(attrname, old, new):

#get currennt values
vy = velocity.value

#generate new x' and ct'
m = vy/c
xn = m*x
yn = x/m

velocity.on_change('value', update)


#set up layout
inputs = column(velocity, x_ra)
Expand Down

0 comments on commit 0ef1a24

Please sign in to comment.