# bug in screen function

**URL:** <https://psychtoolbox.discourse.group/t/bug-in-screen-function/1841>\
**Category:** Uncategorized\
**Created:** [June 14, 2007, 5:48pm UTC](https://psychtoolbox.discourse.group/t/bug-in-screen-function/1841 "2007-06-14T17:48:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 14, 2007, 5:48pm UTC](https://psychtoolbox.discourse.group/t/bug-in-screen-function/1841/1 "2007-06-14T17:48:50Z")

</div>

Hello,  
  
I've been having problems running even a basic script using Psychtoolbox 3. I have tried it on two computers with no luck. This script worked with Psychtoolbox 2. I have also updated both computers I tried it on to Matlab 7.4. The problem I am having is that the screen comes up in color, and the text is flashed in the correct location, but it only remains on-screen for a split second. The screen, in color, remains up for the set 6 seconds. Is this a problem with the DrawText function? Am I coding this incorrectly? Thank you!  
  
  
window = Screen('OpenWindow',0,[200 0 120]);  
Screen('TextFont',window,'Arial Bold');  
Screen('TextSize',window,[30]);  
Screen('DrawText',window,'Test.',100,100,[255]);  
pause(6);  
Screen('CloseAll');

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [June 14, 2007, 11:28pm UTC](https://psychtoolbox.discourse.group/t/bug-in-screen-function/1841/2 "2007-06-14T23:28:49Z")

</div>

\<[http://psychtoolbox.org/wikka.php?wakka=FaqBackwardsCompatible](http://psychtoolbox.org/wikka.php?wakka=FaqBackwardsCompatible)\>  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Pisarcik, Jordan" \<Jordan\_Pisarcik@...\> wrote:  
> \>  
> \> Hello,  
> \>   
> \> I've been having problems running even a basic script using Psychtoolbox 3. I have   
> tried it on two computers with no luck. This script worked with Psychtoolbox 2. I have   
> also updated both computers I tried it on to Matlab 7.4. The problem I am having is that   
> the screen comes up in color, and the text is flashed in the correct location, but it only   
> remains on-screen for a split second. The screen, in color, remains up for the set 6   
> seconds. Is this a problem with the DrawText function? Am I coding this incorrectly?   
> Thank you!  
> \>   
> \>   
> \> window = Screen('OpenWindow',0,[200 0 120]);  
> \> Screen('TextFont',window,'Arial Bold');  
> \> Screen('TextSize',window,[30]);  
> \> Screen('DrawText',window,'Test.',100,100,[255]);  
> \> pause(6);  
> \> Screen('CloseAll');  
> \>

---

<div class="post-metadata">

**Author:** ![franswcornelissen](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@franswcornelissen](https://psychtoolbox.discourse.group/u/franswcornelissen)\
**Post date:** [June 15, 2007, 7:42am UTC](https://psychtoolbox.discourse.group/t/bug-in-screen-function/1841/3 "2007-06-15T07:42:32Z")

</div>

Jordan,  
  
In your particular example, you'll have to add a  
Screen('Flip', window) statement after your last drawing command.  
This will make visible all that you've drawn. Once you get used to it, it is   
actually very handy that drawing is not immediate.   
  
Take a look at some of the demos (in PsychDemos dir) to see how to best use the OpenGL   
version of the PTB.  
  
Frans  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Pisarcik, Jordan" \<Jordan\_Pisarcik@...\> wrote:  
> \>  
> \> Hello,  
> \>   
> \> I've been having problems running even a basic script using Psychtoolbox 3. I have   
> tried it on two computers with no luck. This script worked with Psychtoolbox 2. I have   
> also updated both computers I tried it on to Matlab 7.4. The problem I am having is that   
> the screen comes up in color, and the text is flashed in the correct location, but it only   
> remains on-screen for a split second. The screen, in color, remains up for the set 6   
> seconds. Is this a problem with the DrawText function? Am I coding this incorrectly?   
> Thank you!  
> \>   
> \>   
> \> window = Screen('OpenWindow',0,[200 0 120]);  
> \> Screen('TextFont',window,'Arial Bold');  
> \> Screen('TextSize',window,[30]);  
> \> Screen('DrawText',window,'Test.',100,100,[255]);  
> \> pause(6);  
> \> Screen('CloseAll');  
> \>
