Millisecond Forums

A question about canvas size and background color

https://forums.millisecond.com/Topic34906.aspx

By ylyl27 - 11/3/2022

Hi! I was trying to present stimuli in a 28 cm x 16 cm black rectangular space in the center of the screen. And in each trial, a word will appear at one of the four corners of the rectangle in each trial, like the picture below.

Here's my script. I set the canvas size as (28cm,16cm). But when I ran it, the whole screen was black, instead of just the 28cm x 16cm area. Is there a way to make just the rectangular area as black and other part of the scree as white?

<defaults>
/ canvassize = (28cm, 16cm)
</defaults>

<parameters>
/fontheight = 5%
/responsekey_left = 30
/responsekey_leftlabel = "A"
/responsekey_right = 38
/responsekey_rightlabel = "L"
</parameters>

<item words>
/1 = "word 1"
/2 = "word 2"
/3 = "word 3"
/4 = "word 4"
/5 = "word 5"
/6 = "word 6"
</item>

<text LeftUp>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (20%,20%)
</text>

<text LeftDown>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (20%,80%)
</text>

<text RightUp>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (80%,20%)
</text>

<text RightDown>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (80%,80%)
</text>

<trial LeftUp>
/ posttrialpause = 1000
/ stimulustimes = [0 = LeftUp]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_left)
/ inputdevice = keyboard
</trial>

<trial LeftDown>
/ posttrialpause = 1000
/ stimulustimes = [0 = LeftDown]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_left)
/ inputdevice = keyboard
</trial>

<trial RightUp>
/ posttrialpause = 1000
/ stimulustimes = [0 = RightUp]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_right)
/ inputdevice = keyboard
</trial>

<trial RightDown>
/ posttrialpause = 1000
/ stimulustimes = [0 = RightDown]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_right)
/ inputdevice = keyboard
</trial>

<block task>
/ screencolor = black
/ trials = [1-96 = noreplace(LeftUp,LeftDown,RightUp,RightDown)]
</block>

<expt task>
/ blocks = [1=task]
</expt>
By Dave - 11/3/2022

ylyl27 - 11/3/2022
Hi! I was trying to present stimuli in a 28 cm x 16 cm black rectangular space in the center of the screen. And in each trial, a word will appear at one of the four corners of the rectangle in each trial, like the picture below.

Here's my script. I set the canvas size as (28cm,16cm). But when I ran it, the whole screen was black, instead of just the 28cm x 16cm area. Is there a way to make just the rectangular area as black and other part of the scree as white?

<defaults>
/ canvassize = (28cm, 16cm)
</defaults>

<parameters>
/fontheight = 5%
/responsekey_left = 30
/responsekey_leftlabel = "A"
/responsekey_right = 38
/responsekey_rightlabel = "L"
</parameters>

<item words>
/1 = "word 1"
/2 = "word 2"
/3 = "word 3"
/4 = "word 4"
/5 = "word 5"
/6 = "word 6"
</item>

<text LeftUp>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (20%,20%)
</text>

<text LeftDown>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (20%,80%)
</text>

<text RightUp>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (80%,20%)
</text>

<text RightDown>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (80%,80%)
</text>

<trial LeftUp>
/ posttrialpause = 1000
/ stimulustimes = [0 = LeftUp]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_left)
/ inputdevice = keyboard
</trial>

<trial LeftDown>
/ posttrialpause = 1000
/ stimulustimes = [0 = LeftDown]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_left)
/ inputdevice = keyboard
</trial>

<trial RightUp>
/ posttrialpause = 1000
/ stimulustimes = [0 = RightUp]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_right)
/ inputdevice = keyboard
</trial>

<trial RightDown>
/ posttrialpause = 1000
/ stimulustimes = [0 = RightDown]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_right)
/ inputdevice = keyboard
</trial>

<block task>
/ screencolor = black
/ trials = [1-96 = noreplace(LeftUp,LeftDown,RightUp,RightDown)]
</block>

<expt task>
/ blocks = [1=task]
</expt>

Set /screencolor to white and display a black rectangle <shape> covering 100% of the canvas in each trial.

<defaults>
/ canvassize = (28cm, 16cm)
</defaults>

<parameters>
/fontheight = 5%
/responsekey_left = 30
/responsekey_leftlabel = "A"
/responsekey_right = 38
/responsekey_rightlabel = "L"
</parameters>

<item words>
/1 = "word 1"
/2 = "word 2"
/3 = "word 3"
/4 = "word 4"
/5 = "word 5"
/6 = "word 6"
</item>

<shape blackbg>
/ shape = rectangle
/ color = black
/ size = (100%, 100%)
/ erase = false
</shape>

<text LeftUp>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (20%,20%)
/ erase = true(black)
</text>

<text LeftDown>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (20%,80%)
/ erase = true(black)
</text>

<text RightUp>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (80%,20%)
/ erase = true(black)
</text>

<text RightDown>
/ items = words
/ fontstyle = ("Courier",parameters.fontheight, false, false, false, false, 5, 0)
/ txcolor = white
/ txbgcolor = black
/ position = (80%,80%)
/ erase = true(black)
</text>

<trial LeftUp>
/ posttrialpause = 1000
/ stimulustimes = [0 = blackbg, LeftUp]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_left)
/ inputdevice = keyboard
</trial>

<trial LeftDown>
/ posttrialpause = 1000
/ stimulustimes = [0 = blackbg, LeftDown]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_left)
/ inputdevice = keyboard
</trial>

<trial RightUp>
/ posttrialpause = 1000
/ stimulustimes = [0 = blackbg, RightUp]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_right)
/ inputdevice = keyboard
</trial>

<trial RightDown>
/ posttrialpause = 1000
/ stimulustimes = [0 = blackbg, RightDown]
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ correctresponse = (parameters.responsekey_right)
/ inputdevice = keyboard
</trial>

<block task>
/ screencolor = white
/ trials = [1-96 = noreplace(LeftUp,LeftDown,RightUp,RightDown)]
</block>

<expt task>
/ blocks = [1=task]
</expt>