Hi everyone,
I’m currently running the latest psychopy standalone testing version for mac (1.84.0 64bit) on an iMac with OSX 10.11.
I upgraded to the testing version from 1.83.4 after running into the “packaging” package issue. I’m primarily using this set-up for coding and testing, not for running any experiments.
I’m in the process of writing up a simple version of a planned EEG experiment using the Coder. As part of the experiment I want to visually present an “answer array” with six fields/boxes presenting different text answer option for the subjects to select.
I assumed that using visual.TextBox to assemble my answer array would be the easiest option. As a starting point, I ran the demo script textbox_simple.py and also wrote my own simple script adapting the demo script for testing purposes.
In both cases I run into the problem of text not being properly drawn inside the box. Some parts of the text are not drawn at all while other parts are not aligned with the box. I’m attaching a screenshot to illustrate the problem when running the demo code textbox_simple.py as well as my own code. To troubleshoot, I’ve played around with various parameters of TextBox but couldn’t get the text to be displayed properly. What am I missing?
Any help regarding this issue is greatly appreciated.
from psychopy import visual, core, event
window=visual.Window(size=(800,600),
units='norm',
fullscr=False, allowGUI=True,
screen=0, monitor='testMonitor'
)
textbox1=visual.TextBox(window=window,
text='OptionA',
font_size=32,
font_color=[1,1,1],
size=(.3,.3),
border_color=[1,1,1,1],
pos=(0.15,0.3),
grid_horz_justification='center',
grid_vert_justification='center',
units='norm',
)
textbox2=visual.TextBox(window=window,
text='OptionB',
font_size=32,
font_color=[1,1,1],
size=(.3,.3),
border_color=[1,1,1,1],
pos=(-0.15,0.3),
grid_horz_justification='center',
grid_vert_justification='center',
units='norm',
)
textbox3=visual.TextBox(window=window,
text='OptionC',
font_size=32,
font_color=[1,1,1],
size=(.3,.3),
border_color=[1,1,1,1],
pos=(0.15,0.0),
grid_horz_justification='center',
grid_vert_justification='center',
units='norm',
)
textbox4=visual.TextBox(window=window,
text='OptionD',
font_size=32,
font_color=[1,1,1],
size=(.3,.3),
border_color=[1,1,1,1],
pos=(-0.15,0.0),
grid_horz_justification='center',
grid_vert_justification='center',
units='norm',
)
textbox5=visual.TextBox(window=window,
text='OptionE',
font_size=32,
font_color=[1,1,1],
size=(.3,.3),
border_color=[1,1,1,1],
pos=(0.15,-0.3),
grid_horz_justification='center',
grid_vert_justification='center',
units='norm',
)
textbox6=visual.TextBox(window=window,
text='OptionF',
font_size=32,
font_color=[1,1,1],
size=(.3,.3),
border_color=[1,1,1,1],
pos=(-0.15,-0.3),
grid_horz_justification='center',
grid_vert_justification='center',
units='norm',
)
textbox1.draw()
textbox2.draw()
textbox3.draw()
textbox3.draw()
textbox4.draw()
textbox5.draw()
textbox6.draw()
demo_start=window.flip()
event.clearEvents()
last_attrib_change_time=demo_start
while True:
if core.getTime()-last_attrib_change_time> 2.5:
last_attrib_change_time=core.getTime()
textbox1.draw()
textbox2.draw()
textbox3.draw()
textbox3.draw()
textbox4.draw()
textbox5.draw()
textbox6.draw()
# Update the display to show any stim changes
flip_time=window.flip()
# End the test when a keyboard event is detected
#
kb_events=event.getKeys(keyList = ['l', 'r'])
if kb_events:
break
core.quit()