Open DaveParillo opened 6 years ago
The :textfield:
markup is not an option to activecode, it stands alone and its use case was when using Python to do simple DOM manipulations on the web page. It was never meant to be used as stdin only with the document.getElementById function and then getting its value.
I think what you are looking for is the datafile
directive for python anyway.
In theory I like the option of wiring up stdin for skulpt to correspond to a DOM element. It would take a bit of experimenting with skulpt to see how to make that happen.
I did not mean to imply that :textfield:
is an option to activecode, but simply that there is a fair bit of functional overlap between the two. :stdin:
in active code does one very specific thing and it doesn't do it correctly for all active code languages. :textfield:
is more general purpose and in theory active code could use a text field to provide a consistent interface to stdin for all activecode languages in addition to all the other dom manipulation capabilities it affords.
Also, since I'm a control freak, I just like having the option to control standard input (placement, prompt, size and default value) - currently :stdin:
only allows control over the default value.
I have not looked at datafile
at all yet, so my ignorance in that area might be clouding my perceptions on this ticket.
Now that I've had a chance to look at datafile,
it seems a nice option or replacement for :stdin:
would be to use the id of a datafile directive.
Runestone include two completely different mechanisms for processing simulated standard input to programs.
:stdin:
option to the active code directive:textfield:
inline markup.stdin
works great with languages that ship their work off to a jobe server. However, ifstdin
is used with python, the default value is not used and the text area appears in the popup dialog instead of being added to the code block. Also`input()works, but
stdin.readline()`` does not.It is a bit confusing having two such similar capabilities that do not work consistently across active code languages.
The current stdin does not provide the placement or size flexibility that the textfield markup allows. Also, the styling is not the greatest - it should at least have a space between the prompt and the text field. Not every code block is best served with the prompt:
Input for program
, which is all the stdin option allows.Recommendation
This allows book authors to place the text area where they see fit. For a long code block, placing the text area above the code might be a better choice than below it.