Skip to content

Commit 35ad5bc

Browse files
Toddpeircej
authored andcommitted
BF: Only draw Form when within specified timeframe, fixes #3107
1 parent f30fa28 commit 35ad5bc

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

psychopy/experiment/components/form/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,22 @@ def writeRoutineStartCode(self, buff):
159159
pass
160160

161161
def writeFrameCode(self, buff):
162-
buff.writeIndented("%(name)s.draw()\n" % (self.params))
162+
cond = "if "
163+
if self.params['startVal']:
164+
cond += "t > %(startVal)s"
165+
if self.params['stopVal'] and self.params['startVal']:
166+
cond += " and "
167+
if self.params['stopVal']:
168+
cond += "t < %(startVal)s+%(stopVal)s"
169+
cond += ":\n"
170+
if not self.params['stopVal'] and not self.params['startVal']:
171+
cond = ""
172+
buff.writeIndented((cond +
173+
" %(name)s.draw()\n") % (self.params))
163174

164175
def writeFrameCodeJS(self, buff):
165-
buff.writeIndented("%(name)s.draw();\n" % (self.params))
176+
buff.writeIndented("if t > %(start)s and t < %(stop)s:"
177+
" %(name)s.draw();\n" % (self.params))
166178

167179
def writeRoutineEndCode(self, buff):
168180
# save data, according to row/col format

0 commit comments

Comments
 (0)