Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

tobii - 'Xpyriment' object has no attribute 'set_bgcolor

Hi everyone,

I'm running opensesame in a python 3.10 anaconda environment in order to use a Tobii Pro Fusion eyetracker. My experiment works perfectly in the advanced dummy mouse mode, but when I switch to Tobii (Tobii research has been installed) I got this message:

AttributeError: 'Xpyriment' object has no attribute 'set_bgcolor'


Thanks,

Vincenzo

Comments

  • Hi @nobiles

    It seems like this has happened before (see this issue). I'm not sure if it has been fixed since then, but you could try installing the latest version of Opensesame/Pygaze and check whether you still get the error. 

    If you do, the suggested workaround is to open the offending file (you can find it by looking at the full error traceback; it's most likely a file called osscreen.py) and comment out the line containing self.canvas.set_bgcolor(colour).

    Hope that helps!

    Claire

  • Thanks Claire,

    I followed your suggestions and the tips in the discussion and I commented out the offending lines. However, now the problem is the following:

    File "C:\Users\ET1\.conda\envs\opensesame-py3\lib\site-packages\pygaze\_eyetracker\libtobii.py", line 325, in calibrate
        left_validity = 0.15 < gaze_sample['left_gaze_origin_in_trackbox_coordinate_system'][2] < 0.85
    KeyError: 'left_gaze_origin_in_trackbox_coordinate_system'
    


    Do you have an idea on how to solve it?

    Thanks!

  • edited October 13

    Hi @nobiles

    Once again, it seems like this has happened before (see this issue). The user reports that they resolved the issue by opening the libtobii.py file and replacing all instances of 'trackbox' with 'user' in the following strings:

    • left_gaze_origin_in_trackbox_coordinate_system -> left_gaze_origin_in_user_coordinate_system
    • right_gaze_origin_in_trackbox_coordinate_system -> right_gaze_origin_in_user_coordinate_system

    I'm not sure why this happened, my guess is that it might be related to a version mismatch in your tobii_research package... However, I am not an expert in using Tobii, so I can't say for sure.

    Let me know if that helps!

    Claire

  • Dear Claire,

    thanks, that solved the issue. Your help has been unevaluable!


    For other users of Tobii Pro Fusion, I think it is usefull to summarize all the passages I've done and that made things work:

    1) I created an anaconda environment in which OPensesame 4.1.1. runs in a python 3.10 environment

    https://osdoc.cogsci.nl/4.0/download/#anaconda-cross-platform

    (the psychopy back end gives me an error, so I use Expyriment)


    2) install Tobii_research in the environment

    pip install tobii-research


    3) errors in calibration: edit osscreen.py file by commenting out set_bgcolor and set_penwidth.

    'Xpyriment' object has no attribute 'set_bgcolor'

    'Xpyriment' object has no attribute 'set_penwidth'


    4) error with trackbox: replace in libtobii.py file all instances of 'trackbox' with 'user' in the following strings:

    left_gaze_origin_in_trackbox_coordinate_system -> left_gaze_origin_in_user_coordinate_system

    right_gaze_origin_in_trackbox_coordinate_system -> right_gaze_origin_in_user_coordinate_system


    Then, things seem to work ok.

  • Glad it's working now.

    Thanks for this summary, @nobiles!

Sign In or Register to comment.