How to draw an arc of a circle?

Hey internet!
Could anyone tell me how I can draw a quarter and a one-eighth Circle in psychopy?
Like these?
image
image
Thank you!!!

Hi!
Yo can use Pie stimuli (in code, and for off-line Psychopy only I think). For example, the code below would make a green wedge from 0 to 90 degrees, and a red wedge going from 90 to 135 degrees.

wedgeGreen = visual.Pie(win,fillColor = [-1,1,-1],start = 0,end = 90)
wedgeRed = visual.Pie(win,fillColor = [1,-1,-1],start = 90,end = 135)

Then draw the stimuli for n frames:

nFrames = 120 
for i in range(nFrames):
    wedgeGreen.draw()
    wedgeRed.draw()
    win.flip()

Just to make sure, are you using Coder? If you’re using Builder you can create a code component and copy the first code block in the “Begin Experiment” tab, and copy the following in the “Every Frame” tab:

    wedgeGreen.draw()
    wedgeRed.draw()

Then you would need to have a response component to end the routine, or an empty text component with the duration you want to have for displaying the arcs.

Hope that helps

Hi Nahuel
Thank you so much, it really helps.
Just one more step to go, since I need to use fullscreen(1920x1080) to show the stimuli, the pie-shape will be deformed like these…


(But after I changed the window size into a square like 800x800 it worked well … )

So how can I solve this problem?? Thank you again!!

Don’t use norm units - they depend on the aspect ratio of the screen. If you want relative units, use height instead, or absolute units (cm, pix, deg, etc).

1 Like

THANK YOU SO MUCH!

Is there a way to create the same type of visual.pie stimuli in PsychoJS (i.e. for online experimentation)? Thanks

My assumption is not. If you try it you will probably get a pie is not a constructor error. However, I am planning to create a pie chart demo using 100-500 bespoke polygons.