Stimuli appearing strange, broken with green lines

Hi there,

I’ve just started using PsychoPy and I’ve tried to flip text and a grating, both of which appear broken up with green line/areas.
Anyone know how to fix this?

I’m using PyCharm and I get these error messages, not sure if related:

C:\Users\ra150\AppData\Local\Programs\Python\Python38\lib\site-packages\pyglet\media\codecs\ UserWarning: [WinError -2147417850] Cannot change thread mode after it is set
C:\Users\ra150\AppData\Local\Programs\Python\Python38\lib\site-packages\pyglet\image\codecs\ UserWarning: [WinError -2147417850] Cannot change thread mode after it is set

Here is the code and image for the grating:

import psychopy.visual
import psychopy.event

win = psychopy.visual.Window(

grating = psychopy.visual.GratingStim(
win = win,


The only progress I’ve made is that if I specify winType in .Window as ‘glfw’ then the green lines disappear and everything looks normal, but then the window closes for other errors.

Sorry, I have no ideas about this. Not problem I’ve seen before. You’re using your own installation by the looks of it and a version of Python (3.8) that I haven’t used (probably with a version of pyglet I haven’t tred as well) so my guess it that there’s a problem with one of those things but I really couldn’t offer any explanation as to what.

Thanks for weighing in Jon.
I’ve tried the standalone PsychoPy software as well as using PyCharm and rolling back versions of PsychoPy, pyglet and using Python versions 3.6 -> 3.9. All with the same results.
Any incompatibilities with certain graphics cards that you’re aware of? I’m using Intel® UHD Graphics and NVIDIA GeForce GTX 1650 Ti.

Hmm, that’s the weirdest thing. No, those two graphics cards are both in pretty wide use and I’ve never heard of anyone else having this issue. Does it definitely happen with both cards though?

I’m afraid I don’t really have any suggestions. @mdc knows more about opengl than me and might have some insight into what could cause this artefact.

Not sure at all what’s causing this. Makes less sense given the hardware is common and no one else reported these issues before. I think these might be driver side issues though.

How bizzare. I tried disabling both cards and nothing changed.

Is this a dual/hybrid GPU setup?

I have a GPU - discrete NVIDIA GeForce GTX 1650 Ti and a GPU - integrated Intel UHD Graphics 630. Sorry I don’t know if that means it’s dual/hyrbid.

Just noticed that if it’s full screen then it appears normal… Don’t know what that indicates


Here the solution:

Try to add the argument multiSample and numSamples when you create your window, as in the example below:

w = visual.Window([wstim, hstim], color = [0, 0, 0], units = “pix”, fullscr=False, multiSample=True, numSamples = 16).

In my script this worked fine.

1 Like

Incredible, works wonders. Thank you so much!

I’ve had to migrate to Builder to put the experiment online, do you know how I can implement this in Builder?

This turns out to have been a bug in an Intel graphics driver. Can be fixed properly by updating to a new version of the driver:

Many thanks @Andrea_Adriano for the intervening workaround!

1 Like