Howdy, Stranger!

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

Supported by

Show randomly one of the stimuli presented before, as a question.

edited November 2023 in OpenSesame

Hi everyone.

I have made a loop that shows some pictures in a random order.

After the presentation is finished for each circle I want to present one of the pics that was shown in the specific circle (randomly selected), and ask a quetion about it (e.g. "was it second?"). I have written the following:

from random import shuffle

from openexp.canvas import canvas







my_canvas.text("Was it second;")




I keep getting the error : "bird.png" does not exist

Does anyone have any idea what is going on?


  • Hi @amoupsou,

    Have you made sure that your pictures are uploaded in the file pool?

    If that's not the issue, could you upload your task or a shortened version of it to this forum?



    Buy Me A Coffee

  • Hi Fab, thank you for taking the time.

    Yes, the files are uploaded in the pool. I attach the task here!

  • Hi @amoupsou,

    I had a quick look, spotted that some of your code has an identation problem (some lines of code start with an empty space, which confuses Python). But that in itself does not solve the problem. I don't typically display stimuli using the canvas object from Python and I couldn't find the origin of th problem (perhaps @eduard would know), but it seems to me taht you can achieve what you'd like using a combination of code (to select one of the pictures at random) and the Question_sketchpad to display the question as well as the correspoding picture.

    I attach my modified version where I've done just that.

    Hope this helps,


    Buy Me A Coffee

  • edited November 2023

    Hi Fabrice, this actually works. Thank you very much for your contribution.

    Another thing I am trying to do, is to now set a condition on what the correct response will be. This condition is that if the target_pic that was presented is the same as the var.stimulus2, then the correct response is to type "z".

    I went at the inline script and wrote this far:

    my_canvas = canvas(exp)

    my_canvas.text("Was it second;", center=True, x=500, y=160)



    if target_pic == var.stimulus2:

    correct_response = z   

    Still I get error messages like 'unexpected indent' and when i fix the indent i get the same errors as before (e.g cat doesn't exist).

    Any ideas?

    thank you!!!!

  • Can you share your experiment again?

    in any case, it should be

    if target_pic == var.stimulus2:
        var.correct_response = 'z'  


    Buy Me A Coffee

  • Hi @eduard .

    I added the code you proposed, in the inline script. Still I get errors like 'cat.png does not exist'.

    Thank you!

  • edited December 2023

    You can use a string of the filename directly in the image canvas function. You need to use the entire path of the file. You can get it from the pool object. It is actually quite well explained in the documentation.



    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games