How to make a resetable input box?

2 views
Skip to first unread message

Lauri R.

unread,
Nov 20, 2009, 7:49:22 AM11/20/09
to sage-edu
I'm programming an education application, which poses a problem to a
student and then takes the student's input. After that it checks
whether the answer was correct or incorrect and prints the outcome.

I'd like to make the input field by simply using an input_box of the
interact feature, but my problem is that after each question it should
reset all the fields and introduce a new question. However, as far as
I know, it is impossible to reset the values of interactive fields or
alter them in any way.

Am I right or is there a way to do this? Are there any other
solutions? If someone has experience in making this kind of programs,
I'd like to hear what technologies you have used.

Thanks in advance!

- Lauri R.

PS. Is it possible to hide source code in a notebook in the same way
one can hide an output?

David Joyner

unread,
Nov 21, 2009, 7:18:38 AM11/21/09
to sage...@googlegroups.com
On Fri, Nov 20, 2009 at 7:49 AM, Lauri R. <lauri.ruo...@gmail.com> wrote:
> I'm programming an education application, which poses a problem to a
> student and then takes the student's input. After that it checks
> whether the answer was correct or incorrect and prints the outcome.
>
> I'd like to make the input field by simply using an input_box of the
> interact feature, but my problem is that after each question it should
> reset all the fields and introduce a new question. However, as far as
> I know, it is impossible to reset the values of interactive fields or
> alter them in any way.
>
> Am I right or is there a way to do this? Are there any other
> solutions? If someone has experience in making this kind of programs,
> I'd like to hear what technologies you have used.


I don't know. However, I would try something like Marshall Hampton's
http://wiki.sagemath.org/interact/diffeq#Euler.27sMethod.2CImprovedEuler.2Cand4thorderRunge-Kuttainonevariable
but with "input_box(' ' " or "input_box(default=' ' " in place of the
default value
he has there.


>
> Thanks in advance!
>
> - Lauri R.
>
> PS. Is it possible to hide source code in a notebook in the same way
> one can hide an output?


Use %hide as the top line


>
> --
>
> You received this message because you are subscribed to the Google Groups "sage-edu" group.
> To post to this group, send email to sage...@googlegroups.com.
> To unsubscribe from this group, send email to sage-edu+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sage-edu?hl=.
>
>
>

William Stein

unread,
Nov 22, 2009, 5:17:36 PM11/22/09
to sage...@googlegroups.com
On Sat, Nov 21, 2009 at 4:18 AM, David Joyner <wdjo...@gmail.com> wrote:
> On Fri, Nov 20, 2009 at 7:49 AM, Lauri R. <lauri.ruo...@gmail.com> wrote:
>> I'm programming an education application, which poses a problem to a
>> student and then takes the student's input. After that it checks
>> whether the answer was correct or incorrect and prints the outcome.
>>
>> I'd like to make the input field by simply using an input_box of the
>> interact feature, but my problem is that after each question it should
>> reset all the fields and introduce a new question. However, as far as
>> I know, it is impossible to reset the values of interactive fields or
>> alter them in any way.
>>
>> Am I right or is there a way to do this? Are there any other
>> solutions? If someone has experience in making this kind of programs,
>> I'd like to hear what technologies you have used.

I was working on an interactive debugger for the notebook (using
interact), and ran into the same problem. I'll try to think of a way
to fix this problem by improving interact this week.

William

>
>
> I don't know. However, I would try something like Marshall Hampton's
> http://wiki.sagemath.org/interact/diffeq#Euler.27sMethod.2CImprovedEuler.2Cand4thorderRunge-Kuttainonevariable
> but with "input_box(' ' " or  "input_box(default=' ' " in place of the
> default value
> he has there.
>
>
>>
>> Thanks in advance!
>>
>> - Lauri R.
>>
>> PS. Is it possible to hide source code in a notebook in the same way
>> one can hide an output?
>
>
> Use %hide as the top line
>
>
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups "sage-edu" group.
>> To post to this group, send email to sage...@googlegroups.com.
>> To unsubscribe from this group, send email to sage-edu+u...@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/sage-edu?hl=.
>>
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups "sage-edu" group.
> To post to this group, send email to sage...@googlegroups.com.
> To unsubscribe from this group, send email to sage-edu+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sage-edu?hl=.
>
>
>



--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
Reply all
Reply to author
Forward
0 new messages