Commit 540c0d91 authored by Julian Kirkeby Lysvik's avatar Julian Kirkeby Lysvik

First commit

parent 55a8aecd
<?xml version="1.0" ?>
<PsychoPy2experiment encoding="utf-8" version="3.0.3">
<PsychoPy2experiment encoding="utf-8" version="3.0.4">
<Settings>
<Param name="Completed URL" updates="None" val="" valType="str"/>
<Param name="Data filename" updates="None" val="u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date'])" valType="code"/>
......@@ -301,10 +301,10 @@
</TextComponent>
<CodeComponent name="textinput">
<Param name="Begin Experiment" updates="constant" val="inputText = &quot;&quot;" valType="extendedCode"/>
<Param name="Begin JS Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin JS Experiment" updates="constant" val="function inputText() {&amp;#10; var x = document.createElement(&quot;INPUT&quot;);&amp;#10; x.setAttribute(&quot;type&quot;, &quot;text&quot;);&amp;#10; x.setAttribute(&quot;value&quot;, &quot;&quot;);&amp;#10; document.body.appendChild(x);&amp;#10;}" valType="extendedCode"/>
<Param name="Begin JS Routine" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin Routine" updates="constant" val="theseKeys=&quot;&quot;&amp;#10;shift_flag = False&amp;#10;txtinp.alignHoriz ='center'" valType="extendedCode"/>
<Param name="Code Type" updates="None" val="Py" valType="str"/>
<Param name="Code Type" updates="None" val="Both" valType="str"/>
<Param name="Each Frame" updates="constant" val="n= len(theseKeys)&amp;#10;i = 0&amp;#10;while i &lt; n:&amp;#10;&amp;#10; if theseKeys[i] == 'return' and len(inputText) &gt;1:&amp;#10; # pressing RETURN means time to stop&amp;#10; continueRoutine = False&amp;#10; break&amp;#10;&amp;#10; elif theseKeys[i] == 'backspace':&amp;#10; inputText = inputText[:-1] # lose the final character&amp;#10; i = i + 1&amp;#10;&amp;#10; elif theseKeys[i] == 'space':&amp;#10; inputText += ' '&amp;#10; i = i + 1&amp;#10;&amp;#10; elif theseKeys[i] in ['lshift', 'rshift']:&amp;#10; shift_flag = True&amp;#10; i = i + 1&amp;#10;&amp;#10; else:&amp;#10; if len(theseKeys[i]) == 1:&amp;#10; # we only have 1 char so should be a normal key, &amp;#10; # otherwise it might be 'ctrl' or similar so ignore it&amp;#10; if shift_flag:&amp;#10; inputText += chr( ord(theseKeys[i]) - ord(' '))&amp;#10; shift_flag = False&amp;#10; else:&amp;#10; inputText += theseKeys[i]&amp;#10;&amp;#10; i = i + 1&amp;#10;" valType="extendedCode"/>
<Param name="Each JS Frame" updates="constant" val="" valType="extendedCode"/>
<Param name="End Experiment" updates="constant" val="" valType="extendedCode"/>
......
This diff is collapsed.
......@@ -267,7 +267,12 @@ function experimentInit() {
depth: -3.0
});
function inputText() {
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("value", "");
document.body.appendChild(x);
}
txtinp = new visual.TextStim({
win: psychoJS.window,
name: 'txtinp',
......
......@@ -259,7 +259,12 @@ function experimentInit() {
depth: -3.0
});
function inputText() {
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("value", "");
document.body.appendChild(x);
}
txtinp = new visual.TextStim({
win: psychoJS.window,
name: 'txtinp',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment