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 - Jan 26, 2012 at 3:12PM
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 - Mar 08 2012 3:34PM
Francisco Esquembre
222 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.


The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics