Comments (7)
Is this correct? If not, could you share a rendered example?
If this is correct, I think the issue in your case is with pyglet:
Psychopy_video_experiment.venv\lib\site-packages\pyglet\font\win32.py", line 432, in render
ord(text), ord(text), byref(abc)):
The relevant portion:
it seems to want only one characters worth of data, in UTF-8, that's, what, one byte? (utf-8 i think 8 stands for the bits, so 1 byte) but it's a multi byte character, I think.
If you have a virtual environment, set it up and go to line 430 in your win32.py file and make it like this:
with this one small change everything seems to work fine. (Did that display correctly?) Just add three lines of code and indent the existing. I'm surprised to see this issue in this way. Pyglet can render the text but evidently relies on built in functions which are not setup to handle those characters.
I'm thinking:
- The issue is with pyglet's reliance on what eventually leads to a built in function that can't handle that character
- changing this one thing in pyglet fixed this issue. I'd change pyglett
from psychopy.
Hi @MichaelWoodc, amazing. Thanks a lot for your help. Yes I can confirm that it is indeed correct rendering.
word_to_display = "समर्पण" #displays incorrectly, स + म + र + ् + प + ण
word_to_display = "क्षत्रिय" #displays incorrectly, क + ् + ष + त + ् + र + ि + य
However, some more complex Hindi alphabets are still showing up as separate characters instead of coming up as a single glyph.
Some examples are:
- र + ् + प = र्प
- क + ् + ष = क्ष
Rendering Hindi can be challenging due to its complex script, where multiple units combine to form a single glyph. The good news is that the program can now render individual characters, a task it was unable to do previously.
from psychopy.
from psychopy.
Thanks a lot. I tried to play with changing backends,
The experiment does not load with pygame
and the issue is same with your pyglet hack as with glfw
For now we are using images as text stimuli but for eye-tracker and getting character level data, makes those images useless. Interestingly, OpenSesame library worked for us to render stimuli.
Thanks a lot again for your help @MichaelWoodc
from psychopy.
Actually, I'm most interested in whether we could solve this with TextBox2 rather than TextStim. TextBox2 is written in-house which means we have complete control over how layout works, so we should be able to apply a fix like this ourselves rather than requesting the fix in pyglet. TextBox2 is also much faster to update text than TextStim.
from psychopy.
Oh, I wasn't aware of that. I'll try with some stimuli using TextBox2 and provide an update here.
from psychopy.
Just to be clear, I'm not thinking that TextBox2 already solves the issue - it needs each character manually laying out by us and i don't think we've handled this issues yet - but on the plus side the code to lay out the printable characters is only 20 lines long and is within our control meaning that a solution like @MichaelWoodc found could be very easy to implement here
from psychopy.
Related Issues (20)
- [Bug]: Conda installation via `psychopy-env.yml` python dependency fails
- [Bug]: Can't run PsychoPy after conda installation on Mac Sonoma HOT 6
- [Bug]: PsychPy is unable to load images from a public online source. Specifically, it is unable to load an image from a public AWS s3 bucket, as in: https://neurotype-images.s3.us-east-2.amazonaws.com/affective-images/004504.jpg HOT 4
- psychopy components can't open [Bug]: HOT 15
- [Bug]: Extremely slow rendering of colors HOT 2
- [Bug]: Editable TextBox2 line spacing contamination HOT 2
- [Bug]: Pandas version differs across operating systems HOT 1
- [Bug]: 2024.1.1 is packaged with Python 3.8.x but will not run locally with said version HOT 2
- [Bug]: Two Counterbalance routines with the same name can be added / Conditions file is not updated in Counterbalance routine
- [Bug]:
- [Bug]: System default audio device not used in versions >= 2024
- [Bug]: `Dlg` example raises an exception HOT 2
- Is the entire `pyobjc` package collection required? HOT 1
- [Bug]: Use of pythonw on macos conda/mamba environments breaks app HOT 4
- [Bug]: Space character in column name of conditions file yields `UnboundLocalError` in Builder
- [Bug]: Mistake in documentation for FormComponent
- [Bug]: OverflowError: line number table is too long
- [Bug]: pkg_resources is deprecated
- [Bug]: crash after launch on Ubuntu 22.04
- [Bug]: Not able to connect to my Pavlovia account when running local psychopy version HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psychopy.