APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Modeling Tips & Help post and replies

Return to the Modeling Tips & Help thread
Login to post to this thread

Input from user through textbox on frame
SUNIL KUMAR
1 Posts

i want to get input from the user through text box and then again restart the simulation with updated valuse

can anyone help me in doing this


Replies to Input from user through textbox on frame

Re: Input from user through textbox on frame -
Francisco Esquembre
237 Posts

You have to call _initialize() from the text box Action property.

_initialize() will make the simulation execute whatever you entered in the Initialization pages. Place there the code you need to 'restart' your simulation. This typically includes resetting time to 0, but it may necessary to add other initialization sentences that only you know, since they depend on your model.

You should not call _reset(), because this makes the simulation go through the Variables pages and this most likely overwrites whatever change th user input through your text box.

Paco



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book