[open] Word processor style mouse behavior in text input?
I am conducting an experiment where participants must provide a transcription for a short audio clip from memory. Is there any way to make the text_input widget allow interaction with the mouse, word processor style, as in allow a visible cursor, selection of text using the mouse, and clicking on the text to move the cursor and insert text? A participant may remember some of the middle of the stimulus after they have typed the end part already, and if this happens the default behavior will require them to delete everything they have typed back up to the point where they want to insert text. This may cause them to make mistakes or leave out information, which is really bad for me! Is there a way I can change this? Thanks for your help!
Comments
Hi Heather,
No, I'm afraid that the form
text_inputwidget only supports very basic interactions. This is because it's a custom widget set that has been designed from the ground up to work on a very wide range of systems and configurations. The downside of this approach is that it's quite slow and not as fancy as most modern GUI toolkits.Perhaps you could try the PsychoPy GUI functionality. This is also quite limited, but might be more suitable for your particular situation. The code snippet below can be placed into an
inline_scriptitem and will show a simple dialog box. This requires the psycho back-end.For more information, see:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thank you! I haven't gotten this to work as of yet, but I'm going to get someone with more Python knowledge to help me out.
Heather
Hi Sebastiaan,
So when I try this, using version 27.1 of OpenSesame, it runs, but when it comes to running the internal script item, it gives me an error message "Import Error: No module named wx". It seems that the internal version of Python does not include the wx module. Does this mean I have to run from source?
Heather
Hi Heather,
Ow right! I think there is a good chance that the
wxmodule is included with the WinPython-based distribution of OpenSesame:Does this work? If not, you can manually the
wxpackage to WinPython. That's easier than setting up an entire Python source environment yourself.There's also a forum discussion where you can post technical questions about using the WinPython distribution of OpenSesame (such as how to manually add a package):
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
I tried using the latest version of the Python Portable release, but it still gave me the same error
which looks like this:
Error: Inline script error
In: inline_script (run phase)
File "dist\psychopy\gui.py", line 8
Python traceback:
ImportError: No module named wx
In the debug window it said "ERROR: avbin.dll failed to load" and suggested I import psychopy.visual as the first item, and also to make sure avbin is installed. So I then added "from psychopy import visual" as the first line of the script, but it still failed with the same error.
I am not sure how to check or install avbin, someone mentioned in that thread that modules could be installed using the "python setup.py install" command, but I tried putting "python setup.py install avbin" in there and that was incorrect syntax. Do you think avbin is the problem? If so, could you send me the line of code to run to install it? Sorry for being so Python-unknowledgable, I'm sure it's very simple but I'm not sure of the proper syntax.. thank you so much for your help!
Hi Heather,
The
avbin.dllerror is annoying, but harmless. The problem is the missingwxmodule:The correct way to install a package in general is by opening a terminal (command prompt) in the folder where you have unzipped the package and execute:
python setup.py installSo you don't specify the package name in the command itself: This is already specified because you are calling the
setup.pyfile included with that specific package.But as I mentioned, I would post the installation question in the OpenSesame-portable thread, so that @Edwin sees your question and can give you a more concrete instruction. Because things might work a little differently with WinPython (but not much).
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Btw, I was thinking, you could also give
Tka shot. That's an older module that does pretty much the same thing aswx. The following script should present a text input dialog and store the response asmy_response. I'm not sure how this will behave in a fullscreen experiment though, I suspect it will be highly system dependent. If the dialog doesn't appear or cause OpenSesame to crash, I would try another back-end and see whether that works.Cheers!
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan, I tried downloading wxPython but still had some troubles, so I posted my (extremely long) question to that thread. I tried the Tk script, it crashed with psycho.py backend, xperiment backend is apparently not compatible with my machine (something about OpenGL not being supported). With legacy backend it sort of worked, it brought me to a smaller window with a tiny little entry form that had the right behavior, and there was an Ok button. however, clicking the Ok button did nothing so there seemed to be no way to move forward in the experiment. It was close though! if you have any suggestions of how to modify this script so it might work, let me know, though hopefully @Edwin can help me with the other one.
Thanks so much again for your help!!
Heather