Howdy, Stranger!

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

Supported by

Setting a background that is an image

edited January 2017 in OpenSesame

Hi Guys,

I am trying to edit a small experiment and am not really familiar with this program.
In the beginning of the code we have a code set background "white". How could I do this so that I set an image there instead? Additionally, I would like to have it switching every couple of questions. It would look like this:


Which animal do you prefer (2 pictures in different places to choose)
What food do you prefer?

Which clothing would you rather wear?

etc...

Would be grateful for any responses!

Comments

  • Hi Pain,

    Welcome to the forum!

    What you describe seems absolutely possible, and it could be achieved with multiple methods depending on the exact workings of your experiment.

    The most straightforward option would be to use sketchpad items to present your stimuli (questions) on which you insert a background image. The image can be changed after every X amount of trials, depending on the specific. See the documentation for a better description:

    However, in the example you provide it seems that you want participants to choose between two pictures? If you want to use clickable pictures it might be a solution to use forms instead of sketchpads. Check the documentation what is possible or this recent forum post for more inpsiration:

    Bottom line, it is certainly possible but we need a bit more information on what you have tried so far and what it exactly is that you want to create.

    Best,
    Laurent

  • Thank you!
    I have actually been able to figure this out by using bgroung_image = exp.get_file('materials/house.jpg')
    +
    my_canvas.image(bgroung_image, False, 0, 0), with image sized to the screen resolution. Then, while in loop, it is easy to change them as I wish.

    Now I have a different dilemma, which is changing a cursor. The same idea as before, it should change along with the background - for example to .png of a shooting gun, or to a "+" sign or whatever.

    Is it possible as well?

    Thank you for taking your time to help me, I really appreciate it!

  • Hi again,

    I have actually been able to figure this out by using bgroung_image = exp.get_file('materials/house.jpg')
    +
    my_canvas.image(bgroung_image, False, 0, 0), with image sized to the screen resolution. Then, while in loop, it is easy to change them as I wish.

    Great!

    Now I have a different dilemma, which is changing a cursor. The same idea as before, it should change along with the background - for example to .png of a shooting gun, or to a "+" sign or whatever.

    If i'm not mistaken the cursor is being drawn by your operating system and is therefore difficult to change with OpenSesame. You could try and see if you can manually change the cursor, but then i can't think of a method where you would be able to vary it. Perhaps @sebastiaan has an solution?

  • If i'm not mistaken the cursor is being drawn by your operating system and is therefore difficult to change with OpenSesame.

    Exactly, the mouse cursor is handled by the operating system. If you want to draw your own mouse cursor, you have to hide the actual cursor (it is hidden by default in OpenSesame) and then draw your own cursor onto a canvas. This is actually the example for the documentation of the mouse object. :wink:

    Let's say that you have two files in the file pool: background.png, to be used for the background image, and cursor.png, to be used for the cursor image. Then you could do something like this:

    my_mouse = mouse()
    my_canvas = canvas()
    while True:
        button, position, timestamp = my_mouse.get_click(timeout=20)
        if button is not None:
            break
        (x,y), time = my_mouse.get_pos()
        my_canvas.clear()
        my_canvas.image(pool['background.png'])
        my_canvas.image(pool['cursor.png'], x=x, y=y)
        my_canvas.show()
    
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 http://45.77.173.118/ 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