I experienced a disadvantage using
visual.Polygon for creating triangles. I like the basic idea that this class is based on vertices on the circumcircle and therefore only has a radius parameter for depicting its size. For an uneven number of vertices, however, the center of the shape is different from (i.e., higher than) the center of its circumcircle. Consequently, it seems to be displaced compared to other shapes such as
visual.Rect and it also seems to have a smaller size than a
visual.Circle of the same radius (since the latter is its circumcircle).
I, therefore, suggest to create a class
visual.Triangle as a subclass of
visual.ShapeStim that makes it easier to create triangles of given side length and/or height.
For an equilateral triangle of given height, here is a function I wrote for my purposes:
def Triangle(window, height=1): sideHalf = 0.577350269 #hard coded 1/math.sqrt(3) return visual.ShapeStim(win=window, vertices=((-sideHalf, -0.5), (0, 0.5), (sideHalf, -0.5)), size=height)