Howdy, Stranger!

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

Supported by

[solved] Vertical Slider rating scale?

edited July 2015 in OpenSesame

Is there any possible way to invert slider scale to be vertical (analog scale in PsychoPy for example can not be turned to vertical position)? I`m not programmer in any sense so some detailed instructions are greatly appreciated. Thank you!

Comments

  • edited 6:30PM

    Hello,

    I don't think you can avoid having to program a bit yourself. However, it is not that hard, and there are many discussions dealing with this topic here in the Forum.

    As a starter, you could have a look on this discussion here : http://forum.cogsci.nl/index.php?p=/discussion/1415/solved-slider-and-touch-screen/p1

    It describes rather detailed how to implement a horizontal slider. All you would need to do, is finding and swapping the x and y coordinates accordingly.

    I hope this is what you had in mind?

    Give it a shot, and if you need more help, just ask again.

    Good luck ,

    Eduard

    Buy Me A Coffee

  • edited 6:30PM

    Thank you for your reply. Main idea is to force slider to move upwards while mouse moves upwards, opposite direction accordingly. I`ve tried to change code but have only achieved mouse movement inversion. It looks like slider moves only in x axis. Main goal is y axis increment.

  • edited 6:30PM

    This should do the trick, but you probably need to tweak the code a bit to make it prettier.

    from openexp.canvas import canvas
    from openexp.mouse import mouse
    my_canvas = canvas(self.experiment)
    my_mouse = mouse(self.experiment, timeout=20)
    
    # Set slider dimensions
    slider_w = 500
    slider_h = 100
    slider_x = self.get("width")/2-slider_w/2
    slider_y = self.get("height")/2-slider_h/2
    
    while True:
            # Determine the slider fill based on the mouse position
            pos, time = my_mouse.get_pos()
            x, y = pos
            # If you want to re-enter the slider loop, you need a variable that can be True
            # or False. Initialized as being False. Only if mouse on slider, it becomes True
            enter = False
            if not (x < slider_x - slider_w/2) or (x > slider_x + slider_w/2):
                  enter = True
    
            while enter:
    
                # Determine the slider fill based on the mouse position
                 pos, time = my_mouse.get_pos()
                 x, y = pos
    
                 # Break when the mouse leaves the slider area
                 if (x < slider_x - slider_w/2) or (x > slider_x + slider_w/2):
                      break
    
                 slider_fill = min(slider_w, max(0, y-slider_y))
    
                 my_canvas.clear()
                 # Draw some text (this can be anything)
                 my_canvas.text("Question goes here", y=slider_y-100)   
                 my_canvas.text("Click to accept ...", y=slider_y+100)
                 # Draw the slider frame
                 my_canvas.rect(slider_x, slider_y, slider_h, slider_w)
                 # Draw the slider fill
                 my_canvas.rect(slider_x, slider_y, slider_h, slider_fill, fill=True)               
                 # Draw the mouse cursor 
                 my_canvas.arrow(x+5, y+10, x, y)
                 my_canvas.show()
    
            # Poll the mouse for buttonclicks
            button, position, timestamp = my_mouse.get_click(timeout = 20)
            if button != None:
                break
    
    slider_percent = 100.0*slider_fill/slider_w     
    self.experiment.set("slider_percent", slider_percent)
    

    Buy Me A Coffee

  • edited 6:30PM

    I would like to thank you so much. With your hints I have achieved more than I expected first. Quite amazing OpenSesame actually is.
    image
    The only problem left to solve is output data. Currently after clicking exported csv file is completely empty. I have not dug deeply into documentation yet.
    Thank you once again!

  • edited 6:30PM

    Nice to hear.

    You probably wanna have a look at the logger item (See here)

    Eduard

    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 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