# Coding

**URL:** https://discourse.psychopy.org/c/coder/8.md

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

---

## [About the Coding category](https://discourse.psychopy.org/t/about-the-coding-lib-category/17)

<div class="topic-metadata">

**Author:** [@jon](https://discourse.psychopy.org/u/jon)\
**Replies:** 0

</div>

This category is for questions about writing code using the PsychoPy Python library. Do help others if you can - it's nice and it earns you 'trust' points. Everyone loves to get points, right?

---

## [I canť close windows on PschoPy, please help!](https://discourse.psychopy.org/t/i-cant-close-windows-on-pschopy-please-help/47930)

<div class="topic-metadata">

**Author:** [@Maya\_Vondrackova](https://discourse.psychopy.org/u/Maya_Vondrackova)\
**Replies:** 3\
**Last updated:** [September 25, 2026, 2:00pm UTC](https://discourse.psychopy.org/t/i-cant-close-windows-on-pschopy-please-help/47930 "2026-09-25T14:00:21Z")

</div>

I’m having a serious issue with PsychoPy on my Mac. I recently downloaded PsychoPy version 2026.2.4, and whenever I run even a very simple piece of code, the experiment window opens but then becomes completely unresponsi…

---

## [Step size for Quest?](https://discourse.psychopy.org/t/step-size-for-quest/47760)

<div class="topic-metadata">

**Author:** [@harinisankar16](https://discourse.psychopy.org/u/harinisankar16)\
**Replies:** 2\
**Last updated:** [September 22, 2026, 4:00am UTC](https://discourse.psychopy.org/t/step-size-for-quest/47760 "2026-09-22T04:00:21Z")

</div>

Hi, I am trying to use Quest in my 2AFC intact/scrambled task where I am trying to find the shortest possible display duration that the image can be identified accurately. I’m running this using a 75Hz CRT monitor and b…

---

## [How to use Tobii Glasses with g3pylib](https://discourse.psychopy.org/t/how-to-use-tobii-glasses-with-g3pylib/44286)

<div class="topic-metadata">

**Author:** [@styrkowiec](https://discourse.psychopy.org/u/styrkowiec)\
**Replies:** 3\
**Last updated:** [September 8, 2026, 2:31am UTC](https://discourse.psychopy.org/t/how-to-use-tobii-glasses-with-g3pylib/44286 "2026-09-08T02:31:19Z")

</div>

Does anyone have a code/script for using Tobii Pro Glasses 3 with the g3pylib package and would be willing to share it? Unfortunately, the examples provided on GitHub (tobiipro/g3pylib) only allowed me to connect to the …

---

## [Making Gabors Appear when Mouse is Clicked Anywhere on Screen](https://discourse.psychopy.org/t/making-gabors-appear-when-mouse-is-clicked-anywhere-on-screen/47790)

<div class="topic-metadata">

**Author:** [@lilih](https://discourse.psychopy.org/u/lilih)\
**Replies:** 1\
**Last updated:** [August 31, 2026, 5:33pm UTC](https://discourse.psychopy.org/t/making-gabors-appear-when-mouse-is-clicked-anywhere-on-screen/47790 "2026-08-31T17:33:35Z")

</div>

Hello everyone! I am reaching out for help on how to make shapes appear by clicking the mouse. I previously got help making this happen while clicking within a previously generated shape, but now I want to make the sha…

---

## [Slow loading of videos in experiment](https://discourse.psychopy.org/t/slow-loading-of-videos-in-experiment/47738)

<div class="topic-metadata">

**Author:** [@Phreedomx](https://discourse.psychopy.org/u/Phreedomx)\
**Replies:** 6\
**Last updated:** [August 25, 2026, 1:40pm UTC](https://discourse.psychopy.org/t/slow-loading-of-videos-in-experiment/47738 "2026-08-25T13:40:12Z")

</div>

Hey everyone, I am trying to program an experiment where participants just have to watch videos, and they are also able to “swipe” (using the up arrow key) to the next video. In total, there are a bit over 100 videos th…

---

## [Frame-accurate video playback fails on Windows 11 (PsychoPy backend) - works fine on macOS](https://discourse.psychopy.org/t/frame-accurate-video-playback-fails-on-windows-11-psychopy-backend-works-fine-on-macos/47688)

<div class="topic-metadata">

**Author:** [@LB\_30](https://discourse.psychopy.org/u/LB_30)\
**Replies:** 1\
**Last updated:** [August 18, 2026, 1:39pm UTC](https://discourse.psychopy.org/t/frame-accurate-video-playback-fails-on-windows-11-psychopy-backend-works-fine-on-macos/47688 "2026-08-18T13:39:48Z")

</div>

Hi everyone, We are currently facing an issue with video playback stability on Windows 11, which could disrupt our eye-tracking experiment. While playback is smooth on macOS and in standalone PsychoPy scripts, we see s…

---

## [Full Str not Added to Dictionary in Loop](https://discourse.psychopy.org/t/full-str-not-added-to-dictionary-in-loop/47487)

<div class="topic-metadata">

**Author:** [@lilih](https://discourse.psychopy.org/u/lilih)\
**Replies:** 6\
**Last updated:** [July 28, 2026, 8:21pm UTC](https://discourse.psychopy.org/t/full-str-not-added-to-dictionary-in-loop/47487 "2026-07-28T20:21:40Z")

</div>

Hi everyone! This may not be a PsychoPy specific problem, but for some reason is one of my major stumps on this massive experiment using PsychoPy. Essentially, I am running into an issue where my dictionary is not pick…

---

## [Cannot detect key presses on Ubuntu](https://discourse.psychopy.org/t/cannot-detect-key-presses-on-ubuntu/47480)

<div class="topic-metadata">

**Author:** [@Jiangang\_Shan](https://discourse.psychopy.org/u/Jiangang_Shan)\
**Replies:** 3\
**Last updated:** [July 28, 2026, 8:15pm UTC](https://discourse.psychopy.org/t/cannot-detect-key-presses-on-ubuntu/47480 "2026-07-28T20:15:51Z")

</div>

Hi all! I’m using Ubuntu 24.04, python 3.10.13 and the lastest Psychopy I installed with pip install wxpython-4.2.5-cp310-cp310-linux\_x86\_64.whl and pip install The problem is that I cannot get any key press with my k…

---

## [Csv export bug csv](https://discourse.psychopy.org/t/csv-export-bug-csv/47539)

<div class="topic-metadata">

**Author:** [@lazar](https://discourse.psychopy.org/u/lazar)\
**Replies:** 9\
**Last updated:** [July 28, 2026, 7:11pm UTC](https://discourse.psychopy.org/t/csv-export-bug-csv/47539 "2026-07-28T19:11:11Z")

</div>

when psychopy exports data in cvs format, it incorrectly quotes the quotes… if the field contains double quotes (ASCII code 34) the resulting csv file should have it as “double”. That is " should become “” however, on…

---

## [Mouse Click to Make a Shape Disappear](https://discourse.psychopy.org/t/mouse-click-to-make-a-shape-disappear/47537)

<div class="topic-metadata">

**Author:** [@lilih](https://discourse.psychopy.org/u/lilih)\
**Replies:** 3\
**Last updated:** [July 22, 2026, 10:11pm UTC](https://discourse.psychopy.org/t/mouse-click-to-make-a-shape-disappear/47537 "2026-07-22T22:11:18Z")

</div>

Hello everyone! I am writing with a question on a function of the PsychoPy mouse. In my experiment, I have a function where the user can right click on any of the rectangles and a shape will appear within that rectangl…

---

## [Question about DotStim speed: observed displacement seems twice the configured value](https://discourse.psychopy.org/t/question-about-dotstim-speed-observed-displacement-seems-twice-the-configured-value/47514)

<div class="topic-metadata">

**Author:** [@Candice09](https://discourse.psychopy.org/u/Candice09)\
**Replies:** 0\
**Last updated:** [July 17, 2026, 1:30pm UTC](https://discourse.psychopy.org/t/question-about-dotstim-speed-observed-displacement-seems-twice-the-configured-value/47514 "2026-07-17T13:30:09Z")

</div>

Hello PsychoPy team, I am trying to reproduce a Random Dot Kinematogram originally implemented in PsychoPy in another experimental platform, and I have come across a behaviour that I cannot explain. In my PsychoPy scri…

---

## [How to clean an array of coordinates](https://discourse.psychopy.org/t/how-to-clean-an-array-of-coordinates/47478)

<div class="topic-metadata">

**Author:** [@lilih](https://discourse.psychopy.org/u/lilih)\
**Replies:** 2\
**Last updated:** [July 14, 2026, 8:28am UTC](https://discourse.psychopy.org/t/how-to-clean-an-array-of-coordinates/47478 "2026-07-14T08:28:21Z")

</div>

Hello everyone! I apologize for the question, I’ve been sitting here for a while and this is stumping me for some reason. In my code, I record coordinates from mouse clicks within a given trial. I am trying to compare …

---

## [Sending Triggers to g.Tec Devices](https://discourse.psychopy.org/t/sending-triggers-to-g-tec-devices/30038)

<div class="topic-metadata">

**Author:** [@Giuseppe\_Lai](https://discourse.psychopy.org/u/Giuseppe_Lai)\
**Replies:** 4\
**Last updated:** [June 21, 2026, 12:48pm UTC](https://discourse.psychopy.org/t/sending-triggers-to-g-tec-devices/30038 "2026-06-21T12:48:43Z")

</div>

Hi all, Is anyone aware of how to send trigger events to g.Tec EEG devices? I know it is a short question but I could not find any information online or in this forum. Any help would be appreciated. Thank you for your…

---

## [Textbox2 Changing letterHeight Fails](https://discourse.psychopy.org/t/textbox2-changing-letterheight-fails/47287)

<div class="topic-metadata">

**Author:** [@andrewsilva19](https://discourse.psychopy.org/u/andrewsilva19)\
**Replies:** 1\
**Last updated:** [June 10, 2026, 7:40pm UTC](https://discourse.psychopy.org/t/textbox2-changing-letterheight-fails/47287 "2026-06-10T19:40:10Z")

</div>

This is on psychopy 2026.1.3 I’m trying to change the LetterHeight property of a TextBox2 object, and it simply doesn’t do anything. Doing object.letterHeight = 500 and object.setLetterHeight(500) both simply do nothin…

---

## [Unexpected behavior of flipHoriz in imageStim](https://discourse.psychopy.org/t/unexpected-behavior-of-fliphoriz-in-imagestim/47218)

<div class="topic-metadata">

**Author:** [@dipc](https://discourse.psychopy.org/u/dipc)\
**Replies:** 1\
**Last updated:** [June 2, 2026, 7:47am UTC](https://discourse.psychopy.org/t/unexpected-behavior-of-fliphoriz-in-imagestim/47218 "2026-06-02T07:47:32Z")

</div>

Hi, when changing the flipHoriz property of an imageStim, it seems to matter when the draw command is issued. In the code below, the textStim flips as expected but the imageStim does not. from psychopy import visual, e…

---

## [No module named 'pylink'](https://discourse.psychopy.org/t/no-module-named-pylink/9211)

<div class="topic-metadata">

**Author:** [@idr](https://discourse.psychopy.org/u/idr)\
**Replies:** 2\
**Last updated:** [May 30, 2026, 12:15am UTC](https://discourse.psychopy.org/t/no-module-named-pylink/9211 "2026-05-30T00:15:19Z")

</div>

I’m using PsychoPy3 and trying to run an experiment using our Eyelink 1000 Plus. However, each time I try to run the script I get the error ModuleNotFoundError: No module named 'pylink'. My last eyetracking experiment us…

---

## [How to send triggers to EEG (Neuroscan system)?](https://discourse.psychopy.org/t/how-to-send-triggers-to-eeg-neuroscan-system/4433)

<div class="topic-metadata">

**Author:** [@TimothyWang93](https://discourse.psychopy.org/u/TimothyWang93)\
**Replies:** 7\
**Last updated:** [May 23, 2026, 4:22pm UTC](https://discourse.psychopy.org/t/how-to-send-triggers-to-eeg-neuroscan-system/4433 "2026-05-23T16:22:37Z")

</div>

Hi, all I am currently using Psychopy for my experiments (coding), however I am not quit sure whether Psychopy can send triggers to the EEG (previouly we are using E-prime, which can send triggers, but now we switch to …

---

## [Keyboad events bug](https://discourse.psychopy.org/t/keyboad-events-bug/47068)

<div class="topic-metadata">

**Author:** [@lazar](https://discourse.psychopy.org/u/lazar)\
**Replies:** 7\
**Last updated:** [May 4, 2026, 3:19pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068 "2026-05-04T15:19:46Z")

</div>

dear psychopy I would like to let you know that 2024 version of psychopy has a keyboard handling bug which causes misses of the “press” keyboard events. Have to actually press a button for 10-20 times before it gets det…

---

## [Best way to code very short image presentations](https://discourse.psychopy.org/t/best-way-to-code-very-short-image-presentations/47053)

<div class="topic-metadata">

**Author:** [@antoniyaaboyanova](https://discourse.psychopy.org/u/antoniyaaboyanova)\
**Replies:** 3\
**Last updated:** [April 29, 2026, 7:55am UTC](https://discourse.psychopy.org/t/best-way-to-code-very-short-image-presentations/47053 "2026-04-29T07:55:19Z")

</div>

Hi, I am building a visual masking experiment and image presentation is very important. I need to make sure that I present images for the shortest possible duration for a 60Hz Monitor, which I believe is something like …

---

## [Switching between multiple textboxes](https://discourse.psychopy.org/t/switching-between-multiple-textboxes/46970)

<div class="topic-metadata">

**Author:** [@PaulD](https://discourse.psychopy.org/u/PaulD)\
**Replies:** 0\
**Last updated:** [April 13, 2026, 6:16pm UTC](https://discourse.psychopy.org/t/switching-between-multiple-textboxes/46970 "2026-04-13T18:16:49Z")

</div>

In my experiment, participants will be presented with three textboxes during the test phase, however I am having difficulties figuring out how a participant can choose what textbox to type into. I was wondering if anyon…

---

## [Delay between video and sound in psychopy](https://discourse.psychopy.org/t/delay-between-video-and-sound-in-psychopy/46964)

<div class="topic-metadata">

**Author:** [@Alexandra-Hertz](https://discourse.psychopy.org/u/Alexandra-Hertz)\
**Replies:** 2\
**Last updated:** [April 13, 2026, 7:17am UTC](https://discourse.psychopy.org/t/delay-between-video-and-sound-in-psychopy/46964 "2026-04-13T07:17:52Z")

</div>

Hello, I am using moviestim3 with ptb as audiolib, and ffpyplayer for movielib. When I am playing 1080p videos at 60fps, there is a significative lag between the video and the sound of the video (sound is late). Did anyo…

---

## [Plugin Issues (Advance Vision Science)](https://discourse.psychopy.org/t/plugin-issues-advance-vision-science/46955)

<div class="topic-metadata">

**Author:** [@Annoymous](https://discourse.psychopy.org/u/Annoymous)\
**Replies:** 2\
**Last updated:** [April 10, 2026, 9:34am UTC](https://discourse.psychopy.org/t/plugin-issues-advance-vision-science/46955 "2026-04-10T09:34:25Z")

</div>

Hi I downloaded the plugin for Advance Vision Science. But somehow I can only use it in the builder instead of coder mode. Anyone have any tips for this issue? Error code when I tried to run it in coder File “C:\\Psycho…

---

## [Attempting to measure frame rate of screen ... before each trial](https://discourse.psychopy.org/t/attempting-to-measure-frame-rate-of-screen-before-each-trial/46915)

<div class="topic-metadata">

**Author:** [@gernot](https://discourse.psychopy.org/u/gernot)\
**Replies:** 12\
**Last updated:** [April 9, 2026, 11:05am UTC](https://discourse.psychopy.org/t/attempting-to-measure-frame-rate-of-screen-before-each-trial/46915 "2026-04-09T11:05:34Z")

</div>

I am having “attempting to measure frame rate of screen, please wait” presented shortly before each trial. Cannot kill it. Here in my office I use the latest version of the psychopy package (2026.1.2. on a windows 11 sys…

---

## [Using mouse to switch between textboxes in a given trial](https://discourse.psychopy.org/t/using-mouse-to-switch-between-textboxes-in-a-given-trial/46920)

<div class="topic-metadata">

**Author:** [@PaulD](https://discourse.psychopy.org/u/PaulD)\
**Replies:** 0\
**Last updated:** [April 3, 2026, 9:14pm UTC](https://discourse.psychopy.org/t/using-mouse-to-switch-between-textboxes-in-a-given-trial/46920 "2026-04-03T21:14:01Z")

</div>

During the test phase of my experiment, I have multiple textboxes that the participants can use to type in. Using the builder part of psychopy, I have added two additional textbox components (3 total) to the trials. The …

---

## [Adding data function but the first item is wrong](https://discourse.psychopy.org/t/adding-data-function-but-the-first-item-is-wrong/46875)

<div class="topic-metadata">

**Author:** [@PaulD](https://discourse.psychopy.org/u/PaulD)\
**Replies:** 5\
**Last updated:** [April 3, 2026, 9:05pm UTC](https://discourse.psychopy.org/t/adding-data-function-but-the-first-item-is-wrong/46875 "2026-04-03T21:05:30Z")

</div>

In psychopy I am using the addData function to score an item either a 1 or 2 depending on what condition the item was assigned into before the experiment. The first item is always scored wrong, however the next 39 items …

---

## [psychopy.visual.rect.Rect().contains only works if screen is continuosly flipped](https://discourse.psychopy.org/t/psychopy-visual-rect-rect-contains-only-works-if-screen-is-continuosly-flipped/46906)

<div class="topic-metadata">

**Author:** [@Jpimien](https://discourse.psychopy.org/u/Jpimien)\
**Replies:** 0\
**Last updated:** [March 31, 2026, 5:10pm UTC](https://discourse.psychopy.org/t/psychopy-visual-rect-rect-contains-only-works-if-screen-is-continuosly-flipped/46906 "2026-03-31T17:10:38Z")

</div>

Hello, Everyone. I an new to the psychopy community, I was previously writing tasks in Psychtoolbox and now I am transitioning to Psychopy to run my visual experiments. I wrote a simple gaze contingent task and I used …

---

## [Sound demo not working - are demos generally out of date?](https://discourse.psychopy.org/t/sound-demo-not-working-are-demos-generally-out-of-date/46862)

<div class="topic-metadata">

**Author:** [@AlexHolcombe](https://discourse.psychopy.org/u/AlexHolcombe)\
**Replies:** 1\
**Last updated:** [March 25, 2026, 3:44pm UTC](https://discourse.psychopy.org/t/sound-demo-not-working-are-demos-generally-out-of-date/46862 "2026-03-25T15:44:14Z")

</div>

I’ve been out of the loop for a while, and have noticed that running the soundStimuli.py demo, whether I run it in the old Psychopy Standalone, or if we run it via VSCode, we get errors that seem to indicate that psychop…

---

## [APIs link doesn't work](https://discourse.psychopy.org/t/apis-link-doesnt-work/46846)

<div class="topic-metadata">

**Author:** [@Matt](https://discourse.psychopy.org/u/Matt)\
**Replies:** 4\
**Last updated:** [March 25, 2026, 3:24pm UTC](https://discourse.psychopy.org/t/apis-link-doesnt-work/46846 "2026-03-25T15:24:26Z")

</div>

The link on the home page under the “More” tab brings up a 404 not found.

---

## [Using psychopy standalone on mac with visual studio code](https://discourse.psychopy.org/t/using-psychopy-standalone-on-mac-with-visual-studio-code/34446)

<div class="topic-metadata">

**Author:** [@Tamer\_Gezici](https://discourse.psychopy.org/u/Tamer_Gezici)\
**Replies:** 13\
**Last updated:** [March 23, 2026, 11:32pm UTC](https://discourse.psychopy.org/t/using-psychopy-standalone-on-mac-with-visual-studio-code/34446 "2026-03-23T23:32:34Z")

</div>

Hi, I installed Standalone Psychopy On a Mac computer and I use VS Code as a code editor. How can I add the standalone psychopy as a python interpreter to vs code? Trying to add Applications/PsychoPy.app/Contents/MacOS…

[Next page](https://discourse.psychopy.org/c/coder/8.md?page=1)
