Howdy, Stranger!

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

Supported by

Shrink/enlarge image based on given response

edited November 2017 in OpenSesame

Hi all,

I'm programming an approach-avoid task using inline scripts in opensesame.
Participants have to sort portrait and landscape images by moving the mouse to the top or bottom of the screen.
For mousetracking I'm using mousetrap. I programmed it so that two invisible boxes are on the top and bottom of the screen. And in the middle of the screen the stimulus image is presented.

When someone moves the cursor to the top box (avoid) I want to shrink the picture, and when someone moves the cursor to the bottom box (approach) I want to enlarge the picture.

I can't seem to figure out a way to do this.

As of now the inline script (run phase), after the mousetrap item, looks like this:

response_canvas = canvas()

if var.response_mousetrap_response == "top_box":
    response_canvas.text("Image is supposed to get smaller now")
elif var.response_mousetrap_response == "bottom_box":
    response_canvas.text("Image is supposed to get larger now")

response_canvas.show()

Does anyone know of a way to do this?

Comments

  • Hi Femke,

    Are you using a sketchpad to present the display? If so, then I would download the latest prerelease of OpenSesame 3.2, because it allows you to name and access the elements on a sketchpad. So, say that your image is called, 'my_image' and your sketchpad is called my_sketchpad, then you could increase the size of the image as follows:

    my_canvas = items['my_sketchpad'].canvas
    for scale in range(100, 200):
        my_canvas['my_image'].scale = .01*scale
        my_canvas.show()
    

    See also:

    Cheers!
    Sebastiaan

  • No, I'm using mostly canvas' via inline scripts. But I'll check out your suggestion though. Thanks!

  • Hi Sebastian,

    I have same question. And i tried the code(above), but didn't understand what to write instad of 'my_image'. Should i put my image list name in the block loop? When i put my image list name, i have an error 'KeyError 'image1.png''

    I'd appreciate it if you answered.

    Thanks.

  • I found the answer to my question in another topic on the forum (Eduard's answer).

    Thanks OS.

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