# \#code

**URL:** https://discourse.psychopy.org/tag/code/39.md

[Latest](https://discourse.psychopy.org/latest.md) · [Categories](https://discourse.psychopy.org/categories.md) · [Tags](https://discourse.psychopy.org/tags.md)

---

## ["Dancing" Keyboard Problem when accessing pyschpy textbox on Android devices](https://discourse.psychopy.org/t/dancing-keyboard-problem-when-accessing-pyschpy-textbox-on-android-devices/34457)

<div class="topic-metadata">

**Author:** [@Tay\_Swift](https://discourse.psychopy.org/u/Tay_Swift)\
**Replies:** 2\
**Last updated:** [September 18, 2026, 7:32pm UTC](https://discourse.psychopy.org/t/dancing-keyboard-problem-when-accessing-pyschpy-textbox-on-android-devices/34457 "2026-09-18T19:32:45Z")

</div>

URL of the experiment: untitled \[PsychoPy\] Description of the problem: For the last month, my team and I have been facing this flickering keyboard problem (which we now call the “dancing” keyboard problem in…

---

## [UnboundLocalError: local variable ‘video’ referenced before assignment (MovieStim initialized too late from Builder?)](https://discourse.psychopy.org/t/unboundlocalerror-local-variable-video-referenced-before-assignment-moviestim-initialized-too-late-from-builder/47657)

<div class="topic-metadata">

**Author:** [@monicathieu](https://discourse.psychopy.org/u/monicathieu)\
**Replies:** 2\
**Last updated:** [August 18, 2026, 4:53pm UTC](https://discourse.psychopy.org/t/unboundlocalerror-local-variable-video-referenced-before-assignment-moviestim-initialized-too-late-from-builder/47657 "2026-08-18T16:53:04Z")

</div>

If this template helps then use it. If not then just delete and start from scratch. OS: Mac OS 2026.5.1 PsychoPy version: Studio 2026.2.1 Standard Standalone Installation? (y/n) No, PsychoPy Studio Do you want it to …

---

## [Exp with Movie stimuli on Pavlovia does not start in the iPad](https://discourse.psychopy.org/t/exp-with-movie-stimuli-on-pavlovia-does-not-start-in-the-ipad/47018)

<div class="topic-metadata">

**Author:** [@lara112534](https://discourse.psychopy.org/u/lara112534)\
**Replies:** 0\
**Last updated:** [April 23, 2026, 8:38am UTC](https://discourse.psychopy.org/t/exp-with-movie-stimuli-on-pavlovia-does-not-start-in-the-ipad/47018 "2026-04-23T08:38:37Z")

</div>

Hi, I’m trying to run an experiment from Pavlovia on my iPad Air (2025). The experiment starts with a routine with a full-screen video, which should start only after the screen is clicked. Then, the experiment continues…

---

## [Randomise stimuli without consecutive presentation](https://discourse.psychopy.org/t/randomise-stimuli-without-consecutive-presentation/24343)

<div class="topic-metadata">

**Author:** [@you330](https://discourse.psychopy.org/u/you330)\
**Replies:** 8\
**Last updated:** [April 8, 2026, 9:07pm UTC](https://discourse.psychopy.org/t/randomise-stimuli-without-consecutive-presentation/24343 "2026-04-08T21:07:01Z")

</div>

Hi, I am programming a psychological experiment. In every trial, they read a scenario and see a face photo and hear an answer for the scenario. Scenarios are 20. And there are 4 conditions for the scenarios. (Happy f…

---

## [Response Box vs Target Box HELP! :)](https://discourse.psychopy.org/t/response-box-vs-target-box-help/46858)

<div class="topic-metadata">

**Author:** [@dindooku](https://discourse.psychopy.org/u/dindooku)\
**Replies:** 1\
**Last updated:** [March 23, 2026, 4:51pm UTC](https://discourse.psychopy.org/t/response-box-vs-target-box-help/46858 "2026-03-23T16:51:04Z")

</div>

Hi all, I am creating an experiment that includes an ‘image’ witha target inside of it, and it is up to the participant to look at the image, identify the target, inidicate using the keyboard whether the target is prese…

---

## [Parallel Port Issues w/ Windows 11](https://discourse.psychopy.org/t/parallel-port-issues-w-windows-11/45464)

<div class="topic-metadata">

**Author:** [@stanley1O1](https://discourse.psychopy.org/u/stanley1O1)\
**Replies:** 20\
**Last updated:** [October 7, 2025, 1:44pm UTC](https://discourse.psychopy.org/t/parallel-port-issues-w-windows-11/45464 "2025-10-07T13:44:01Z")

</div>

I am trying to utilize a Magstim TMS machine with Psychopy (via TTL signalling) and having difficulties getting psychopy to cooperate with the port address. I have tried utilizing the solutions found in previous threads…

---

## [Keyboard responses not registering in online experiment when limiting to numeric values](https://discourse.psychopy.org/t/keyboard-responses-not-registering-in-online-experiment-when-limiting-to-numeric-values/45476)

<div class="topic-metadata">

**Author:** [@J\_10](https://discourse.psychopy.org/u/J_10)\
**Replies:** 2\
**Last updated:** [August 26, 2025, 2:52pm UTC](https://discourse.psychopy.org/t/keyboard-responses-not-registering-in-online-experiment-when-limiting-to-numeric-values/45476 "2025-08-26T14:52:10Z")

</div>

OS (e.g. Win10): Win11 PsychoPy version (e.g. 2024.2.4 Py 3.8): 2025.1.1 Standard Standalone Installation? (y/n) If not then what?: Y Do you want it to also run locally? (y/n) N What are you trying to achieve?: I a…

---

## [Generating dynamic auditory stimuli online](https://discourse.psychopy.org/t/generating-dynamic-auditory-stimuli-online/45165)

<div class="topic-metadata">

**Author:** [@MMS](https://discourse.psychopy.org/u/MMS)\
**Replies:** 3\
**Last updated:** [July 9, 2025, 7:56am UTC](https://discourse.psychopy.org/t/generating-dynamic-auditory-stimuli-online/45165 "2025-07-09T07:56:34Z")

</div>

Hi! I am quite new to Psychopy. I apologize if the question is rather obvious. I am using the standalone version of Pychopy. My goal is to create an experiment where stimuli are generated dynamically with values that d…

---

## [Sending multiple triggers using a for loop within a code component](https://discourse.psychopy.org/t/sending-multiple-triggers-using-a-for-loop-within-a-code-component/33838)

<div class="topic-metadata">

**Author:** [@elise1](https://discourse.psychopy.org/u/elise1)\
**Replies:** 3\
**Last updated:** [June 16, 2025, 9:02pm UTC](https://discourse.psychopy.org/t/sending-multiple-triggers-using-a-for-loop-within-a-code-component/33838 "2025-06-16T21:02:28Z")

</div>

Psychopy version 2022.2.5 What are you trying to achieve?: I’m able to send a single trigger within a routine using the code provided in the “sending triggers via serial port” help page, but id like to modify it to sen…

---

## [Pavlovia - logic stops working when moving from preview to pilot/running](https://discourse.psychopy.org/t/pavlovia-logic-stops-working-when-moving-from-preview-to-pilot-running/45014)

<div class="topic-metadata">

**Author:** [@Liatf](https://discourse.psychopy.org/u/Liatf)\
**Replies:** 1\
**Last updated:** [June 10, 2025, 11:04pm UTC](https://discourse.psychopy.org/t/pavlovia-logic-stops-working-when-moving-from-preview-to-pilot-running/45014 "2025-06-10T23:04:52Z")

</div>

As the title states - my conditions work when in preview mode for a survey I’m building, but when I switch to pilot or running the conditions no longer work. It seems to be getting stuck at one particular question (excl…

---

## [Experiment uploads to but won't initiate on Pavlovia](https://discourse.psychopy.org/t/experiment-uploads-to-but-wont-initiate-on-pavlovia/44984)

<div class="topic-metadata">

**Author:** [@QVCLonline](https://discourse.psychopy.org/u/QVCLonline)\
**Replies:** 1\
**Last updated:** [June 6, 2025, 6:45pm UTC](https://discourse.psychopy.org/t/experiment-uploads-to-but-wont-initiate-on-pavlovia/44984 "2025-06-06T18:45:19Z")

</div>

Hi! I’d like some advice on putting an experiment onto Pavlovia. The experiment uploads to Pavlovia and loads the files, but gets stuck on initializing the experiment and will display only a white screen. I suspect ther…

---

## [Variables collected during experiment are not being recorded in CSV file](https://discourse.psychopy.org/t/variables-collected-during-experiment-are-not-being-recorded-in-csv-file/29688)

<div class="topic-metadata">

**Author:** [@eakwayena](https://discourse.psychopy.org/u/eakwayena)\
**Replies:** 3\
**Last updated:** [May 30, 2025, 2:41am UTC](https://discourse.psychopy.org/t/variables-collected-during-experiment-are-not-being-recorded-in-csv-file/29688 "2025-05-30T02:41:38Z")

</div>

I am experiencing an issue with my current experiement code. I have created a few variables that I will be collecting during my experiment: slider\_data, key\_press, key\_name, key\_duration. However, upon downloading a CSV …

---

## [Millikey (LaBHackers) Button Box integration in PsychoPy 2024.1.5](https://discourse.psychopy.org/t/millikey-labhackers-button-box-integration-in-psychopy-2024-1-5/44803)

<div class="topic-metadata">

**Author:** [@ana\_grvt](https://discourse.psychopy.org/u/ana_grvt)\
**Replies:** 2\
**Last updated:** [May 13, 2025, 7:04am UTC](https://discourse.psychopy.org/t/millikey-labhackers-button-box-integration-in-psychopy-2024-1-5/44803 "2025-05-13T07:04:16Z")

</div>

Hi everyone, I’m trying to use a Millikey SR-R1 button box (by LabHackers) to collect responses and reaction times in a PsychoPy experiment, but I haven’t been able to get it working so far. I’m using PsychoPy version …

---

## [Using keyboard buttons to move slider direction left and right](https://discourse.psychopy.org/t/using-keyboard-buttons-to-move-slider-direction-left-and-right/28897)

<div class="topic-metadata">

**Author:** [@eakwayena](https://discourse.psychopy.org/u/eakwayena)\
**Replies:** 3\
**Last updated:** [March 24, 2025, 11:39am UTC](https://discourse.psychopy.org/t/using-keyboard-buttons-to-move-slider-direction-left-and-right/28897 "2025-03-24T11:39:02Z")

</div>

If this template helps then use it. If not then just delete and start from scratch. OS : Windows 10 Home Version 21 H2 OS Build 19044.1645 PsychoPy version (e.g. 1.84.x): 2020.1.2 What are you trying to achieve?: My e…

---

## [\[TUTORIAL\] How to transform an E-Prime project into a PsychoPy project](https://discourse.psychopy.org/t/tutorial-how-to-transform-an-e-prime-project-into-a-psychopy-project/44300)

<div class="topic-metadata">

**Author:** [@carodak](https://discourse.psychopy.org/u/carodak)\
**Replies:** 0\
**Last updated:** [March 19, 2025, 1:43pm UTC](https://discourse.psychopy.org/t/tutorial-how-to-transform-an-e-prime-project-into-a-psychopy-project/44300 "2025-03-19T13:43:41Z")

</div>

Hey, About a year ago, my colleague and I wrote a tutorial for our lab on how to port an E-Prime project to PsychoPy. Today I saw the document in my drive, which hasn’t been used in a long time, and decided to make it a…

---

## [Flicker paradigm problems](https://discourse.psychopy.org/t/flicker-paradigm-problems/43834)

<div class="topic-metadata">

**Author:** [@Glen](https://discourse.psychopy.org/u/Glen)\
**Replies:** 3\
**Last updated:** [February 11, 2025, 6:22pm UTC](https://discourse.psychopy.org/t/flicker-paradigm-problems/43834 "2025-02-11T18:22:22Z")

</div>

If this template helps then use it. If not then just delete and start from scratch. OS: WIn 10 PsychoPy version (e.g. v2024.1.4): \*\*Standard Standalone? \*\* Yes What are you trying to achieve?: A flicker paradigm/chan…

---

## [Beginner guide for PsychoJS (setting up environment for local coding)](https://discourse.psychopy.org/t/beginner-guide-for-psychojs-setting-up-environment-for-local-coding/43619)

<div class="topic-metadata">

**Author:** [@Tan\_Le](https://discourse.psychopy.org/u/Tan_Le)\
**Replies:** 1\
**Last updated:** [January 24, 2025, 8:44am UTC](https://discourse.psychopy.org/t/beginner-guide-for-psychojs-setting-up-environment-for-local-coding/43619 "2025-01-24T08:44:13Z")

</div>

Hi, I am a relatively beginner to Psychopy in general. I have read the docs and watched some videos about deployment to Pavlovia and it seems deployment through Builder is the easiest way. However, due to various reaso…

---

## [Randomize Answers in Psychopy builder/code from Excel sheet](https://discourse.psychopy.org/t/randomize-answers-in-psychopy-builder-code-from-excel-sheet/43312)

<div class="topic-metadata">

**Author:** [@marissa\_munroe](https://discourse.psychopy.org/u/marissa_munroe)\
**Replies:** 1\
**Last updated:** [December 18, 2024, 10:55am UTC](https://discourse.psychopy.org/t/randomize-answers-in-psychopy-builder-code-from-excel-sheet/43312 "2024-12-18T10:55:27Z")

</div>

Hello! I am currently creating an experiment task where I want the participants to view the question and 4 answer choices on the screen at the same time and pick the correct answer. I feel like this should be a simple s…

---

## [Repeating missed trials](https://discourse.psychopy.org/t/repeating-missed-trials/42935)

<div class="topic-metadata">

**Author:** [@Zelal\_Gulbahce](https://discourse.psychopy.org/u/Zelal_Gulbahce)\
**Replies:** 22\
**Last updated:** [November 29, 2024, 10:25pm UTC](https://discourse.psychopy.org/t/repeating-missed-trials/42935 "2024-11-29T22:25:34Z")

</div>

URL of experiment: Description of the problem: Hello, I am trying to repeat a set of trials when a response has been missed. I used the same logic as the one in the repeat subset demo provided by wake carter. Specifi…

---

## [To measure the hold length on the stimuli without showing the feedback](https://discourse.psychopy.org/t/to-measure-the-hold-length-on-the-stimuli-without-showing-the-feedback/42943)

<div class="topic-metadata">

**Author:** [@zyadelmahdy](https://discourse.psychopy.org/u/zyadelmahdy)\
**Replies:** 7\
**Last updated:** [November 18, 2024, 1:42pm UTC](https://discourse.psychopy.org/t/to-measure-the-hold-length-on-the-stimuli-without-showing-the-feedback/42943 "2024-11-18T13:42:35Z")

</div>

If this template helps then use it. If not then just delete and start from scratch. OS (e.g. Win10): MacOS Sequoia 15.1 PsychoPy version (e.g. 1.84.x): v2024.1.5 Standard Standalone? (y/n) If not then what?: y What …

---

## [Adding wintab component to builder](https://discourse.psychopy.org/t/adding-wintab-component-to-builder/42807)

<div class="topic-metadata">

**Author:** [@Jakoban2411](https://discourse.psychopy.org/u/Jakoban2411)\
**Replies:** 1\
**Last updated:** [November 4, 2024, 9:50am UTC](https://discourse.psychopy.org/t/adding-wintab-component-to-builder/42807 "2024-11-04T09:50:00Z")

</div>

Hello, I added the wintab component to the builder. I have forked the main branch and pushed my changes on here: GitHub - Jakoban2411/psychopyWinTab: For running psychology and neuroscience experiments I wanted to cont…

---

## [Sound file (wav) not working in loop on Pavlovia](https://discourse.psychopy.org/t/sound-file-wav-not-working-in-loop-on-pavlovia/42652)

<div class="topic-metadata">

**Author:** [@Zelal\_Gulbahce](https://discourse.psychopy.org/u/Zelal_Gulbahce)\
**Replies:** 3\
**Last updated:** [October 26, 2024, 8:54pm UTC](https://discourse.psychopy.org/t/sound-file-wav-not-working-in-loop-on-pavlovia/42652 "2024-10-26T20:54:05Z")

</div>

URL of experiment: Description of the problem: Hello, I have a single sound file (wav) as component in two of my routines. These routines are included in a loop. I know the sound file has to be set to constant, but due …

---

## [Improper recording of clicks when using a timer](https://discourse.psychopy.org/t/improper-recording-of-clicks-when-using-a-timer/42413)

<div class="topic-metadata">

**Author:** [@E\_T](https://discourse.psychopy.org/u/E_T)\
**Replies:** 1\
**Last updated:** [October 23, 2024, 9:43pm UTC](https://discourse.psychopy.org/t/improper-recording-of-clicks-when-using-a-timer/42413 "2024-10-23T21:43:49Z")

</div>

OS : MacOS Sonoma PsychoPy version: 2022.2.4 Standard Standalone? (y/n) Yes What are you trying to achieve?: I am creating a task in which a set of stimuli must be clicked in a specific order. If the user clicks the…

---

## [Not opening in fullscreen](https://discourse.psychopy.org/t/not-opening-in-fullscreen/42390)

<div class="topic-metadata">

**Author:** [@stanley1O1](https://discourse.psychopy.org/u/stanley1O1)\
**Replies:** 1\
**Last updated:** [October 9, 2024, 8:25am UTC](https://discourse.psychopy.org/t/not-opening-in-fullscreen/42390 "2024-10-09T08:25:03Z")

</div>

PsychoPy version (e.g. 2023.2.3): I am having issues with at the very start of my experiment. I have a code route in a routine at the start of my experiment. It is set to “before experiment” as it imports an API for an …

---

## [How to synchronize video playback with auditory stimuli in PsychoPy?](https://discourse.psychopy.org/t/how-to-synchronize-video-playback-with-auditory-stimuli-in-psychopy/42370)

<div class="topic-metadata">

**Author:** [@Graceeee2024](https://discourse.psychopy.org/u/Graceeee2024)\
**Replies:** 1\
**Last updated:** [October 9, 2024, 2:22am UTC](https://discourse.psychopy.org/t/how-to-synchronize-video-playback-with-auditory-stimuli-in-psychopy/42370 "2024-10-09T02:22:01Z")

</div>

Hi everyone, I am currently designing an auditory ERP experiment using PsychoPy Builder and have encountered a challenge I hope you can help me with. I have successfully created a practice loop and a main experiment lo…

---

## [Text Component is not presenting the way I want it to (presents entire list twice before moving on to the next trial)](https://discourse.psychopy.org/t/text-component-is-not-presenting-the-way-i-want-it-to-presents-entire-list-twice-before-moving-on-to-the-next-trial/41271)

<div class="topic-metadata">

**Author:** [@Ghalia\_El\_Hayawan](https://discourse.psychopy.org/u/Ghalia_El_Hayawan)\
**Replies:** 3\
**Last updated:** [September 12, 2024, 9:24pm UTC](https://discourse.psychopy.org/t/text-component-is-not-presenting-the-way-i-want-it-to-presents-entire-list-twice-before-moving-on-to-the-next-trial/41271 "2024-09-12T21:24:25Z")

</div>

OS (e.g. Win10): Win11 PsychoPy version (e.g. 1.84.x): v2024.2.1post4 Standard Standalone? (y/n) If not then what?: Yes What are you trying to achieve?: This is a followup to my previous thread (see previous thread …

---

## [My code components works correctly in the background but does not show the result I want on builder. What do I do?r](https://discourse.psychopy.org/t/my-code-components-works-correctly-in-the-background-but-does-not-show-the-result-i-want-on-builder-what-do-i-do-r/41092)

<div class="topic-metadata">

**Author:** [@Ghalia\_El\_Hayawan](https://discourse.psychopy.org/u/Ghalia_El_Hayawan)\
**Replies:** 9\
**Last updated:** [September 12, 2024, 9:09pm UTC](https://discourse.psychopy.org/t/my-code-components-works-correctly-in-the-background-but-does-not-show-the-result-i-want-on-builder-what-do-i-do-r/41092 "2024-09-12T21:09:33Z")

</div>

OS (e.g. Win10): Windows 11 PsychoPy version (e.g. 1.84.x): Psychopy Builder (v2024.1.5) Standard Standalone? (y/n) If not then what?: Yes What are you trying to achieve?: In my experiment the participant must clic…

---

## [Colour-Wheel doesn't function properly online](https://discourse.psychopy.org/t/colour-wheel-doesnt-function-properly-online/41250)

<div class="topic-metadata">

**Author:** [@Max\_Boquoi](https://discourse.psychopy.org/u/Max_Boquoi)\
**Replies:** 0\
**Last updated:** [September 2, 2024, 12:38pm UTC](https://discourse.psychopy.org/t/colour-wheel-doesnt-function-properly-online/41250 "2024-09-02T12:38:29Z")

</div>

URL of experiment: Chromasthesia \[PsychoPy\] Description of the problem: I will attach a picture of the problem. There are two issues right now: I have used the code-component to build a colour-wheel with 360 different …

---

## [Changing trigger number for varying stimuli in builder](https://discourse.psychopy.org/t/changing-trigger-number-for-varying-stimuli-in-builder/22351)

<div class="topic-metadata">

**Author:** [@lla76ter7](https://discourse.psychopy.org/u/lla76ter7)\
**Replies:** 2\
**Last updated:** [August 15, 2024, 9:54am UTC](https://discourse.psychopy.org/t/changing-trigger-number-for-varying-stimuli-in-builder/22351 "2024-08-15T09:54:48Z")

</div>

I am very happy about getting mor involved in using Psychopy, but I struggle a bit. I just got a new brain vision EEG system (from brain products) including a triggerbox that connects my stimulus laptop with the amplifie…

---

## [Hide mouse cursor in builder?](https://discourse.psychopy.org/t/hide-mouse-cursor-in-builder/1782)

<div class="topic-metadata">

**Author:** [@jashubbard](https://discourse.psychopy.org/u/jashubbard)\
**Replies:** 14\
**Last updated:** [May 16, 2024, 12:08am UTC](https://discourse.psychopy.org/t/hide-mouse-cursor-in-builder/1782 "2024-05-16T00:08:13Z")

</div>

I have an experiment where subjects respond with the mouse only at the end of each trial. I have a separate routine for this response period, which includes a mouse event. The problem is, the mouse cursor is displayed th…

[Next page](https://discourse.psychopy.org/tag/code/39.md?match_all_tags=true&page=1&tags%5B%5D=code)
