Psychtoolbox - Text for Instruction [closed]

五迷三道 提交于 2019-12-11 10:58:45

问题


I have some problems using Psychtoolbox Screen and Textwindow... For my experiment I want to give an instruction at the beginning. I used something like this: % Draw text in the middle of the screen in Courier in white

Screen('TextSize', window, 20);
Screen('TextFont', window, 'Courier');
DrawFormattedText(window, 'Hello World', 'center', 'center', white);

And the other basic Screen definitions. The problem is: The text is not fully shown. I tried different sizes and set the Font to Times, but it is always the same - every letter is only displayed 3/4 (ca)...

What could be the problem? Would be very nice if someone can give me a hint...

Thanks!


回答1:


Can you describe what you mean by 'every letter is only displayed 3/4 (ca)"? The code you posted looks correct. For example, here is that code, with the addition of some set-up routines, and taking and saving a screenshot as "testImage.png", with the screen shot attached.

screenNum = max(Screen('Screens'));
window = Screen('OpenWindow', screenNum, 0);
white = WhiteIndex(window);
Screen('TextSize', window, 20);
Screen('TextFont', window, 'Courier');
DrawFormattedText(window, 'Hello World', 'center', 'center', white)
Screen('Flip', window);
imageArray = Screen('GetImage', window);
WaitSecs(3);
Screen('CloseAll');
imwrite(imageArray, 'testImage.png');




回答2:


I found the problem... Just a dumb mistake in my long Code. I have set the Font and Size of Text earlier, and this interfered with this new text features. Nevertheless, thank you for your help!



来源:https://stackoverflow.com/questions/45741766/psychtoolbox-text-for-instruction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!