how to draw rectangles in a circle? ('Legacy' object has no attribute error)
Hello,
For a working memory task, I make 6 photos appear in a circle at 60 degree angles. After this stimulus presentation, I am trying to draw 6 empty, white framed rectangles at the angles at which these 6 photographs appear. I also want to have the numbers "1","2","3"..."6" one by one inside these rectangles. These rectangles will be presented, and then participants will choose the location of the photos they just saw. I'm trying to draw rectangles in circles, but the code I wrote doesn't work. Can you help me to solve the problem?
Thanks in advance.
Here is the error code I got: File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\inline_script.py", line 92, in prepare
self.workspace._exec(self.cprepare)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\base_python_workspace.py", line 124, in _exec
exec(bytecode, self._globals)
Inline script, line 41, in <module>
AttributeError: 'Legacy' object has no attribute 'canvas'
Also this is the link of my experiment:
https://drive.google.com/file/d/1VbPCUDkMr9jOHIaDJjBjXvYfZAvPVqR0/view?usp=sharing
Comments
Hi @bssengul ,
The issue results from these lines:
rectangle1 = Canvas () # ... # Dikdörtgeni çizme for i in range(num_rectangles): rectangle1.canvas.rect(left=var.x[i], top=var.y[i], width=rect_width, height=rect_height, fill_color='', line_color=rect_color)First, you're creating a
Canvasobject calledrectangle1. Next, you're trying to accessrectangle1.canvasas thoughrectangle1, which is itself aCanvas, in turns hascanvasproperty inside it, which it doesn't. Do you see the conceptual mistake here?More generally, I would first walk through the intermediate Python tutorial to familiarize yourself with the basics of using Python in OpenSesame:
Hope this helps!
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thank you!