We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Invalid literal for int() when assigning variable to "N Vertices"
I'm trying to tell psychopy to display a polygon with a random number of vertices on each presentation by using randint.  I keep running into this error:

`invalid literal for int() with base 10: 'randint(3, 4, 1)'`

This occurs before the script compiles, so it doesn't produce any output / traceback other than that.  

I've also tried this using $randint(3, 4, 1) but that doesn't work as well.  In addition, my friend had this problem when specifying the number of angles via an excel file.

When I just insert a number to the field, it works fine, so it seems like python is trying to interpret randint(3, 4, 1) literally, sees that it isn't an integer, and throws an error.

Variable assignment:
![image](https://f.cloud.github.com/assets/1839645/1603669/14c4adc4-53ae-11e3-9c09-4e562ed69e8c.png)

Error after clicking run:
![image](https://f.cloud.github.com/assets/1839645/1603672/27c7b952-53ae-11e3-8a0a-4402f6da4fb7.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `psychopy/app/builder/components/polygon.py`
Content:
```
1 # Part of the PsychoPy library
2 # Copyright (C) 2013 Jonathan Peirce
3 # Distributed under the terms of the GNU General Public License (GPL).
4 
5 from _visual import * #to get the template visual component
6 from os import path
7 from psychopy.app.builder.components import getInitVals
8 
9 thisFolder = path.abspath(path.dirname(__file__))#the absolute path to the folder containing this path
10 iconFile = path.join(thisFolder,'polygon.png')
11 tooltip = 'Polygon: any regular polygon (line, triangle, square...circle)'
12 
13 class PolygonComponent(VisualComponent):
14     """A class for presenting grating stimuli"""
15     def __init__(self, exp, parentName, name='polygon', interpolate='linear',
16                 units='from exp settings',
17                 lineColor='$[1,1,1]', lineColorSpace='rgb', lineWidth=1,
18                 fillColor='$[1,1,1]', fillColorSpace='rgb',
19                 nVertices = 4,
20                 pos=[0,0], size=[0.5,0.5], ori=0,
21                 startType='time (s)', startVal=0.0,
22                 stopType='duration (s)', stopVal=1.0,
23                 startEstim='', durationEstim=''):
24         #initialise main parameters from base stimulus
25         VisualComponent.__init__(self,exp,parentName,name=name, units=units,
26                     pos=pos, size=size, ori=ori,
27                     startType=startType, startVal=startVal,
28                     stopType=stopType, stopVal=stopVal,
29                     startEstim=startEstim, durationEstim=durationEstim)
30         self.type='Polygon'
31         self.url="http://www.psychopy.org/builder/components/shape.html"
32         self.exp.requirePsychopyLibs(['visual'])
33         self.order=['nVertices']
34         #params
35         self.params['nVertices']=Param(nVertices, valType='code',
36             updates='constant', allowedUpdates=['constant','set every repeat'],
37             hint="How many vertices? 2=line, 3=triangle... (90 approximates a circle)",
38             label="N Vertices")
39         self.params['fillColorSpace']=Param(fillColorSpace, valType='str', allowedVals=['rgb','dkl','lms'],
40             updates='constant',
41             hint="Choice of color space for the fill color (rgb, dkl, lms)",
42             label="Fill color space")
43         self.params['fillColor']=Param(fillColor, valType='str', allowedTypes=[],
44             updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],
45             hint="Fill color of this shape; Right-click to bring up a color-picker (rgb only)",
46             label="Fill color")
47         self.params['lineColorSpace']=Param(lineColorSpace, valType='str', allowedVals=['rgb','dkl','lms'],
48             updates='constant',
49             hint="Choice of color space for the fill color (rgb, dkl, lms)",
50             label="Line color space")
51         self.params['lineColor']=Param(lineColor, valType='str', allowedTypes=[],
52             updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],
53             hint="Line color of this shape; Right-click to bring up a color-picker (rgb only)",
54             label="Line color")
55         self.params['lineWidth']=Param(lineWidth, valType='code', allowedTypes=[],
56             updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],
57             hint="Width of the shape's line (always in pixels - this does NOT use 'units')",
58             label="Line width")
59         self.params['interpolate']=Param(interpolate, valType='str', allowedVals=['linear','nearest'],
60             updates='constant', allowedUpdates=[],
61             hint="How should the image be interpolated if/when rescaled",
62             label="Interpolate")
63         self.params['size']=Param(size, valType='code', allowedTypes=[],
64             updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],
65             hint="Size of this stimulus [w,h]. Note that for a line only the first value is used, for triangle and rect the [w,h] is as expected, but for higher-order polygons it represents the [w,h] of the ellipse that the polygon sits on!! ",
66             label="Size [w,h]")
67         del self.params['color']
68         del self.params['colorSpace']
69 
70     def writeInitCode(self,buff):
71         #do we need units code?
72         if self.params['units'].val=='from exp settings': unitsStr=""
73         else: unitsStr="units=%(units)s, " %self.params
74         inits = getInitVals(self.params)#replaces variable params with defaults
75         if int(self.params['nVertices'].val) == 2:
76             buff.writeIndented("%s = visual.Line(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
77             buff.writeIndented("    start=(-%(size)s[0]/2.0, 0), end=(+%(size)s[0]/2.0, 0),\n" %(inits) )
78         elif int(self.params['nVertices'].val) == 3:
79             buff.writeIndented("%s = visual.ShapeStim(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
80             buff.writeIndented("    vertices = [[-%(size)s[0]/2.0,-%(size)s[1]/2.0], [+%(size)s[0]/2.0,-%(size)s[1]/2.0], [0,%(size)s[1]/2.0]],\n" %(inits) )
81         elif int(self.params['nVertices'].val) == 4:
82             buff.writeIndented("%s = visual.Rect(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
83             buff.writeIndented("    width=%(size)s[0], height=%(size)s[1],\n" %(inits) )
84         else:
85             buff.writeIndented("%s = visual.Polygon(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
86             buff.writeIndented("    edges = %(nVertices)s, size=%(size)s,\n" %(inits) )
87         buff.writeIndented("    ori=%(ori)s, pos=%(pos)s,\n" %(inits) )
88         buff.writeIndented("    lineWidth=%(lineWidth)s, lineColor=%(lineColor)s, lineColorSpace=%(lineColorSpace)s,\n" %(inits) )
89         buff.writeIndented("    fillColor=%(fillColor)s, fillColorSpace=%(fillColorSpace)s,\n" %(inits) )
90         buff.writeIndented("    opacity=%(opacity)s," %(inits) )
91         if self.params['interpolate'].val=='linear':
92             buff.write("interpolate=True)\n")
93         else: buff.write("interpolate=False)\n")
94
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/psychopy/app/builder/components/polygon.py b/psychopy/app/builder/components/polygon.py
--- a/psychopy/app/builder/components/polygon.py
+++ b/psychopy/app/builder/components/polygon.py
@@ -32,8 +32,8 @@
         self.exp.requirePsychopyLibs(['visual'])
         self.order=['nVertices']
         #params
-        self.params['nVertices']=Param(nVertices, valType='code',
-            updates='constant', allowedUpdates=['constant','set every repeat'],
+        self.params['nVertices']=Param(nVertices, valType='int',
+            updates='constant', allowedUpdates=['constant'],
             hint="How many vertices? 2=line, 3=triangle... (90 approximates a circle)",
             label="N Vertices")
         self.params['fillColorSpace']=Param(fillColorSpace, valType='str', allowedVals=['rgb','dkl','lms'],
@@ -72,18 +72,19 @@
         if self.params['units'].val=='from exp settings': unitsStr=""
         else: unitsStr="units=%(units)s, " %self.params
         inits = getInitVals(self.params)#replaces variable params with defaults
-        if int(self.params['nVertices'].val) == 2:
+        if self.params['nVertices'].val == '2':
             buff.writeIndented("%s = visual.Line(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
             buff.writeIndented("    start=(-%(size)s[0]/2.0, 0), end=(+%(size)s[0]/2.0, 0),\n" %(inits) )
-        elif int(self.params['nVertices'].val) == 3:
+        elif self.params['nVertices'].val == '3':
             buff.writeIndented("%s = visual.ShapeStim(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
             buff.writeIndented("    vertices = [[-%(size)s[0]/2.0,-%(size)s[1]/2.0], [+%(size)s[0]/2.0,-%(size)s[1]/2.0], [0,%(size)s[1]/2.0]],\n" %(inits) )
-        elif int(self.params['nVertices'].val) == 4:
+        elif self.params['nVertices'].val == '4':
             buff.writeIndented("%s = visual.Rect(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
             buff.writeIndented("    width=%(size)s[0], height=%(size)s[1],\n" %(inits) )
         else:
             buff.writeIndented("%s = visual.Polygon(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
-            buff.writeIndented("    edges = %(nVertices)s, size=%(size)s,\n" %(inits) )
+            buff.writeIndented("    edges = %s," % str(inits['nVertices'].val))
+            buff.writeIndented(" size=%(size)s,\n" %(inits) )
         buff.writeIndented("    ori=%(ori)s, pos=%(pos)s,\n" %(inits) )
         buff.writeIndented("    lineWidth=%(lineWidth)s, lineColor=%(lineColor)s, lineColorSpace=%(lineColorSpace)s,\n" %(inits) )
         buff.writeIndented("    fillColor=%(fillColor)s, fillColorSpace=%(fillColorSpace)s,\n" %(inits) )

{"golden_diff": "diff --git a/psychopy/app/builder/components/polygon.py b/psychopy/app/builder/components/polygon.py\n--- a/psychopy/app/builder/components/polygon.py\n+++ b/psychopy/app/builder/components/polygon.py\n@@ -32,8 +32,8 @@\n         self.exp.requirePsychopyLibs(['visual'])\n         self.order=['nVertices']\n         #params\n-        self.params['nVertices']=Param(nVertices, valType='code',\n-            updates='constant', allowedUpdates=['constant','set every repeat'],\n+        self.params['nVertices']=Param(nVertices, valType='int',\n+            updates='constant', allowedUpdates=['constant'],\n             hint=\"How many vertices? 2=line, 3=triangle... (90 approximates a circle)\",\n             label=\"N Vertices\")\n         self.params['fillColorSpace']=Param(fillColorSpace, valType='str', allowedVals=['rgb','dkl','lms'],\n@@ -72,18 +72,19 @@\n         if self.params['units'].val=='from exp settings': unitsStr=\"\"\n         else: unitsStr=\"units=%(units)s, \" %self.params\n         inits = getInitVals(self.params)#replaces variable params with defaults\n-        if int(self.params['nVertices'].val) == 2:\n+        if self.params['nVertices'].val == '2':\n             buff.writeIndented(\"%s = visual.Line(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n             buff.writeIndented(\"    start=(-%(size)s[0]/2.0, 0), end=(+%(size)s[0]/2.0, 0),\\n\" %(inits) )\n-        elif int(self.params['nVertices'].val) == 3:\n+        elif self.params['nVertices'].val == '3':\n             buff.writeIndented(\"%s = visual.ShapeStim(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n             buff.writeIndented(\"    vertices = [[-%(size)s[0]/2.0,-%(size)s[1]/2.0], [+%(size)s[0]/2.0,-%(size)s[1]/2.0], [0,%(size)s[1]/2.0]],\\n\" %(inits) )\n-        elif int(self.params['nVertices'].val) == 4:\n+        elif self.params['nVertices'].val == '4':\n             buff.writeIndented(\"%s = visual.Rect(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n             buff.writeIndented(\"    width=%(size)s[0], height=%(size)s[1],\\n\" %(inits) )\n         else:\n             buff.writeIndented(\"%s = visual.Polygon(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n-            buff.writeIndented(\"    edges = %(nVertices)s, size=%(size)s,\\n\" %(inits) )\n+            buff.writeIndented(\"    edges = %s,\" % str(inits['nVertices'].val))\n+            buff.writeIndented(\" size=%(size)s,\\n\" %(inits) )\n         buff.writeIndented(\"    ori=%(ori)s, pos=%(pos)s,\\n\" %(inits) )\n         buff.writeIndented(\"    lineWidth=%(lineWidth)s, lineColor=%(lineColor)s, lineColorSpace=%(lineColorSpace)s,\\n\" %(inits) )\n         buff.writeIndented(\"    fillColor=%(fillColor)s, fillColorSpace=%(fillColorSpace)s,\\n\" %(inits) )\n", "issue": "Invalid literal for int() when assigning variable to \"N Vertices\"\nI'm trying to tell psychopy to display a polygon with a random number of vertices on each presentation by using randint.  I keep running into this error:\n\n`invalid literal for int() with base 10: 'randint(3, 4, 1)'`\n\nThis occurs before the script compiles, so it doesn't produce any output / traceback other than that.  \n\nI've also tried this using $randint(3, 4, 1) but that doesn't work as well.  In addition, my friend had this problem when specifying the number of angles via an excel file.\n\nWhen I just insert a number to the field, it works fine, so it seems like python is trying to interpret randint(3, 4, 1) literally, sees that it isn't an integer, and throws an error.\n\nVariable assignment:\n![image](https://f.cloud.github.com/assets/1839645/1603669/14c4adc4-53ae-11e3-9c09-4e562ed69e8c.png)\n\nError after clicking run:\n![image](https://f.cloud.github.com/assets/1839645/1603672/27c7b952-53ae-11e3-8a0a-4402f6da4fb7.png)\n\n", "before_files": [{"content": "# Part of the PsychoPy library\n# Copyright (C) 2013 Jonathan Peirce\n# Distributed under the terms of the GNU General Public License (GPL).\n\nfrom _visual import * #to get the template visual component\nfrom os import path\nfrom psychopy.app.builder.components import getInitVals\n\nthisFolder = path.abspath(path.dirname(__file__))#the absolute path to the folder containing this path\niconFile = path.join(thisFolder,'polygon.png')\ntooltip = 'Polygon: any regular polygon (line, triangle, square...circle)'\n\nclass PolygonComponent(VisualComponent):\n    \"\"\"A class for presenting grating stimuli\"\"\"\n    def __init__(self, exp, parentName, name='polygon', interpolate='linear',\n                units='from exp settings',\n                lineColor='$[1,1,1]', lineColorSpace='rgb', lineWidth=1,\n                fillColor='$[1,1,1]', fillColorSpace='rgb',\n                nVertices = 4,\n                pos=[0,0], size=[0.5,0.5], ori=0,\n                startType='time (s)', startVal=0.0,\n                stopType='duration (s)', stopVal=1.0,\n                startEstim='', durationEstim=''):\n        #initialise main parameters from base stimulus\n        VisualComponent.__init__(self,exp,parentName,name=name, units=units,\n                    pos=pos, size=size, ori=ori,\n                    startType=startType, startVal=startVal,\n                    stopType=stopType, stopVal=stopVal,\n                    startEstim=startEstim, durationEstim=durationEstim)\n        self.type='Polygon'\n        self.url=\"http://www.psychopy.org/builder/components/shape.html\"\n        self.exp.requirePsychopyLibs(['visual'])\n        self.order=['nVertices']\n        #params\n        self.params['nVertices']=Param(nVertices, valType='code',\n            updates='constant', allowedUpdates=['constant','set every repeat'],\n            hint=\"How many vertices? 2=line, 3=triangle... (90 approximates a circle)\",\n            label=\"N Vertices\")\n        self.params['fillColorSpace']=Param(fillColorSpace, valType='str', allowedVals=['rgb','dkl','lms'],\n            updates='constant',\n            hint=\"Choice of color space for the fill color (rgb, dkl, lms)\",\n            label=\"Fill color space\")\n        self.params['fillColor']=Param(fillColor, valType='str', allowedTypes=[],\n            updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],\n            hint=\"Fill color of this shape; Right-click to bring up a color-picker (rgb only)\",\n            label=\"Fill color\")\n        self.params['lineColorSpace']=Param(lineColorSpace, valType='str', allowedVals=['rgb','dkl','lms'],\n            updates='constant',\n            hint=\"Choice of color space for the fill color (rgb, dkl, lms)\",\n            label=\"Line color space\")\n        self.params['lineColor']=Param(lineColor, valType='str', allowedTypes=[],\n            updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],\n            hint=\"Line color of this shape; Right-click to bring up a color-picker (rgb only)\",\n            label=\"Line color\")\n        self.params['lineWidth']=Param(lineWidth, valType='code', allowedTypes=[],\n            updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],\n            hint=\"Width of the shape's line (always in pixels - this does NOT use 'units')\",\n            label=\"Line width\")\n        self.params['interpolate']=Param(interpolate, valType='str', allowedVals=['linear','nearest'],\n            updates='constant', allowedUpdates=[],\n            hint=\"How should the image be interpolated if/when rescaled\",\n            label=\"Interpolate\")\n        self.params['size']=Param(size, valType='code', allowedTypes=[],\n            updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],\n            hint=\"Size of this stimulus [w,h]. Note that for a line only the first value is used, for triangle and rect the [w,h] is as expected, but for higher-order polygons it represents the [w,h] of the ellipse that the polygon sits on!! \",\n            label=\"Size [w,h]\")\n        del self.params['color']\n        del self.params['colorSpace']\n\n    def writeInitCode(self,buff):\n        #do we need units code?\n        if self.params['units'].val=='from exp settings': unitsStr=\"\"\n        else: unitsStr=\"units=%(units)s, \" %self.params\n        inits = getInitVals(self.params)#replaces variable params with defaults\n        if int(self.params['nVertices'].val) == 2:\n            buff.writeIndented(\"%s = visual.Line(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n            buff.writeIndented(\"    start=(-%(size)s[0]/2.0, 0), end=(+%(size)s[0]/2.0, 0),\\n\" %(inits) )\n        elif int(self.params['nVertices'].val) == 3:\n            buff.writeIndented(\"%s = visual.ShapeStim(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n            buff.writeIndented(\"    vertices = [[-%(size)s[0]/2.0,-%(size)s[1]/2.0], [+%(size)s[0]/2.0,-%(size)s[1]/2.0], [0,%(size)s[1]/2.0]],\\n\" %(inits) )\n        elif int(self.params['nVertices'].val) == 4:\n            buff.writeIndented(\"%s = visual.Rect(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n            buff.writeIndented(\"    width=%(size)s[0], height=%(size)s[1],\\n\" %(inits) )\n        else:\n            buff.writeIndented(\"%s = visual.Polygon(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n            buff.writeIndented(\"    edges = %(nVertices)s, size=%(size)s,\\n\" %(inits) )\n        buff.writeIndented(\"    ori=%(ori)s, pos=%(pos)s,\\n\" %(inits) )\n        buff.writeIndented(\"    lineWidth=%(lineWidth)s, lineColor=%(lineColor)s, lineColorSpace=%(lineColorSpace)s,\\n\" %(inits) )\n        buff.writeIndented(\"    fillColor=%(fillColor)s, fillColorSpace=%(fillColorSpace)s,\\n\" %(inits) )\n        buff.writeIndented(\"    opacity=%(opacity)s,\" %(inits) )\n        if self.params['interpolate'].val=='linear':\n            buff.write(\"interpolate=True)\\n\")\n        else: buff.write(\"interpolate=False)\\n\")\n", "path": "psychopy/app/builder/components/polygon.py"}], "after_files": [{"content": "# Part of the PsychoPy library\n# Copyright (C) 2013 Jonathan Peirce\n# Distributed under the terms of the GNU General Public License (GPL).\n\nfrom _visual import * #to get the template visual component\nfrom os import path\nfrom psychopy.app.builder.components import getInitVals\n\nthisFolder = path.abspath(path.dirname(__file__))#the absolute path to the folder containing this path\niconFile = path.join(thisFolder,'polygon.png')\ntooltip = 'Polygon: any regular polygon (line, triangle, square...circle)'\n\nclass PolygonComponent(VisualComponent):\n    \"\"\"A class for presenting grating stimuli\"\"\"\n    def __init__(self, exp, parentName, name='polygon', interpolate='linear',\n                units='from exp settings',\n                lineColor='$[1,1,1]', lineColorSpace='rgb', lineWidth=1,\n                fillColor='$[1,1,1]', fillColorSpace='rgb',\n                nVertices = 4,\n                pos=[0,0], size=[0.5,0.5], ori=0,\n                startType='time (s)', startVal=0.0,\n                stopType='duration (s)', stopVal=1.0,\n                startEstim='', durationEstim=''):\n        #initialise main parameters from base stimulus\n        VisualComponent.__init__(self,exp,parentName,name=name, units=units,\n                    pos=pos, size=size, ori=ori,\n                    startType=startType, startVal=startVal,\n                    stopType=stopType, stopVal=stopVal,\n                    startEstim=startEstim, durationEstim=durationEstim)\n        self.type='Polygon'\n        self.url=\"http://www.psychopy.org/builder/components/shape.html\"\n        self.exp.requirePsychopyLibs(['visual'])\n        self.order=['nVertices']\n        #params\n        self.params['nVertices']=Param(nVertices, valType='int',\n            updates='constant', allowedUpdates=['constant'],\n            hint=\"How many vertices? 2=line, 3=triangle... (90 approximates a circle)\",\n            label=\"N Vertices\")\n        self.params['fillColorSpace']=Param(fillColorSpace, valType='str', allowedVals=['rgb','dkl','lms'],\n            updates='constant',\n            hint=\"Choice of color space for the fill color (rgb, dkl, lms)\",\n            label=\"Fill color space\")\n        self.params['fillColor']=Param(fillColor, valType='str', allowedTypes=[],\n            updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],\n            hint=\"Fill color of this shape; Right-click to bring up a color-picker (rgb only)\",\n            label=\"Fill color\")\n        self.params['lineColorSpace']=Param(lineColorSpace, valType='str', allowedVals=['rgb','dkl','lms'],\n            updates='constant',\n            hint=\"Choice of color space for the fill color (rgb, dkl, lms)\",\n            label=\"Line color space\")\n        self.params['lineColor']=Param(lineColor, valType='str', allowedTypes=[],\n            updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],\n            hint=\"Line color of this shape; Right-click to bring up a color-picker (rgb only)\",\n            label=\"Line color\")\n        self.params['lineWidth']=Param(lineWidth, valType='code', allowedTypes=[],\n            updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],\n            hint=\"Width of the shape's line (always in pixels - this does NOT use 'units')\",\n            label=\"Line width\")\n        self.params['interpolate']=Param(interpolate, valType='str', allowedVals=['linear','nearest'],\n            updates='constant', allowedUpdates=[],\n            hint=\"How should the image be interpolated if/when rescaled\",\n            label=\"Interpolate\")\n        self.params['size']=Param(size, valType='code', allowedTypes=[],\n            updates='constant', allowedUpdates=['constant','set every repeat','set every frame'],\n            hint=\"Size of this stimulus [w,h]. Note that for a line only the first value is used, for triangle and rect the [w,h] is as expected, but for higher-order polygons it represents the [w,h] of the ellipse that the polygon sits on!! \",\n            label=\"Size [w,h]\")\n        del self.params['color']\n        del self.params['colorSpace']\n\n    def writeInitCode(self,buff):\n        #do we need units code?\n        if self.params['units'].val=='from exp settings': unitsStr=\"\"\n        else: unitsStr=\"units=%(units)s, \" %self.params\n        inits = getInitVals(self.params)#replaces variable params with defaults\n        if self.params['nVertices'].val == '2':\n            buff.writeIndented(\"%s = visual.Line(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n            buff.writeIndented(\"    start=(-%(size)s[0]/2.0, 0), end=(+%(size)s[0]/2.0, 0),\\n\" %(inits) )\n        elif self.params['nVertices'].val == '3':\n            buff.writeIndented(\"%s = visual.ShapeStim(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n            buff.writeIndented(\"    vertices = [[-%(size)s[0]/2.0,-%(size)s[1]/2.0], [+%(size)s[0]/2.0,-%(size)s[1]/2.0], [0,%(size)s[1]/2.0]],\\n\" %(inits) )\n        elif self.params['nVertices'].val == '4':\n            buff.writeIndented(\"%s = visual.Rect(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n            buff.writeIndented(\"    width=%(size)s[0], height=%(size)s[1],\\n\" %(inits) )\n        else:\n            buff.writeIndented(\"%s = visual.Polygon(win=win, name='%s',%s\\n\" %(inits['name'],inits['name'],unitsStr))\n            buff.writeIndented(\"    edges = %s,\" % str(inits['nVertices'].val))\n            buff.writeIndented(\" size=%(size)s,\\n\" %(inits) )\n        buff.writeIndented(\"    ori=%(ori)s, pos=%(pos)s,\\n\" %(inits) )\n        buff.writeIndented(\"    lineWidth=%(lineWidth)s, lineColor=%(lineColor)s, lineColorSpace=%(lineColorSpace)s,\\n\" %(inits) )\n        buff.writeIndented(\"    fillColor=%(fillColor)s, fillColorSpace=%(fillColorSpace)s,\\n\" %(inits) )\n        buff.writeIndented(\"    opacity=%(opacity)s,\" %(inits) )\n        if self.params['interpolate'].val=='linear':\n            buff.write(\"interpolate=True)\\n\")\n        else: buff.write(\"interpolate=False)\\n\")\n", "path": "psychopy/app/builder/components/polygon.py"}]}