Tag Archives: gui

input

Distributing Python Scripts – the Batchtraveller.app

[en]This is a short intro on how Python-scripts can be packaged into an easy to distribute mac-app.

Essentially I followed two tutorials. The first on how to turn your python script into a self-contained app, the second on how to make compressed diskimages for mac. The final result aswell as the files necessary to reproduce the steps can be downloaded here. A detailed desription can be found in the remainder of this post.

Continue reading

Poor but Sexy – GUIs for bash-files with Zenity

Every now and then we want to work with others who are less inclined to working with the console to use some bash files. As most of the skripts we make, only take a few options, we might think of adding a nice gui to the bash-file so that others are more likely to use it. As always, this can be done very quickly and for free in Linux.

All you need is to install the programm zenity and then write a script, that calls zenity to set the value of a parameter.

sudo apt-get install zenity

Then your next “program” is only a couple of lines away.

My first “project” – I will propably laugh about this one in a couple of weeks – was a little GUI that should replace a textstring “999999″  in a textfile with a string that is entered via the gui and save the result with a new filename. You only need to save the following code in a bash-file, e.g. “replace.sh” and make it executable.

#!/bin/bash

cd /home/vikp/Desktop/HLT

var=$(zenity –entry –text “Enter the replacement text” –entry-text “”)

sed s/9999999/$VP_name/g *.txt > newname_$var.dat

 

The reason I needed this was that I wanted a wrapper for psytoolkit – the brialliant linux program for reaction-time experiments – that asks for a participant codes and adds this code to the result file. The complete wrapper for psytoolkit now looks like this:

#!/bin/bash

cd /home/vikp/Desktop/HLT

VP_name=$(zenity –entry –text “Participant-Code” –entry-text “”)

./experiment

sed s/9999999/$VP_name/g hlt_5.psy.*.data > HLT_VP_$VP_name.dat

 

 

Reaction-time experiments with PsychoPy

If you still cannot decide which tool to use for your next reaction-time experiment we make it a little harder. We already introduced a Affect which is win-only and has a graphical user interface and PsyToolkit which is Linux-only and is script-based. Here is another great option. PsychoPy is based on Python and has a gui which means, that:

  1. it runs on all platforms,
  2. affords experiments of any complexity,
  3. the gui helps those who BEGIN running experiments. To me this is much like learning any natural language. If you are only abroad for your 2 weeks vacation, it is ok to walk around and point to the things you want. But if you live there it’s rude not to learn the language.

That’s what the developers say about it:

PsychoPy is an open-source application to allow the presentation of stimuli and collection of data for a wide range of neuroscience, psychology and psychophysics experiments. It’s a free, powerful alternative to Presentation™ or e-Prime™, written in Python (a free alternative to Matlab™ ).

Cons:

  • Compared to PsyToolkit, it is somewhat more complex to control the trial timing in PsychoPy. Maybe some complete examples for well-known paradigms – the PsyToolkit site is an excellent example for this – would help.