Howdy, Stranger!

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

Supported by

[solved] Python inline script: Widgets in form overlapping

edited April 2014 in OpenSesame

Hello,

I recently updated Open Sesame to the newest version 2.8.1. Unfortunately, I now always get an error message in a python inline script stating me that one or more widgets in my form are overlapping. However, I cannot find the overlap. Is there an option to see which widgets are overlapping and causing the error message to occur?

Or maybe, I am too blind to find the overlap:

form_pdg_test.set_widget(choice_heading, (0,10), colspan=100,rowspan=8)
form_pdg_test.set_widget(choice_question, (50,28), colspan=10,rowspan=7)
form_pdg_test.set_widget(checkbox_c, (43,36),colspan=16,rowspan=4)
form_pdg_test.set_widget(checkbox_d, (57,36),colspan=16,rowspan=4)

form_pdg_test.set_widget(o_choice, (17,44), colspan=15, rowspan=4)
form_pdg_test.set_widget(o_coop, (32,41), colspan=10, rowspan=4)
form_pdg_test.set_widget(o_defect, (32,48), colspan=10, rowspan=4)

form_pdg_test.set_widget(s_reward, (42,41), colspan=10, rowspan=2)
form_pdg_test.set_widget(o_reward, (46,43), colspan=10, rowspan=2)

form_pdg_test.set_widget(s_sucker, (42,48), colspan=10, rowspan=2)
form_pdg_test.set_widget(o_temptation, (46,50), colspan=10, rowspan=2)

form_pdg_test.set_widget(s_temptation, (56,41), colspan=10, rowspan=2)
form_pdg_test.set_widget(o_sucker, (60,43), colspan=10, rowspan=2)

form_pdg_test.set_widget(s_punish, (56,48), colspan=10, rowspan=2)
form_pdg_test.set_widget(o_punish, (60,50), colspan=10, rowspan=2)

form_pdg_test.set_widget(finished_button_mc, (45,60),colspan=10,rowspan=5)

Thank you in advance for your help!

Best regards,
Isabel

Comments

  • edited 2:54PM

    Hi Isabel,

    It's a bit difficult to spot by eye (you have so many columns and rows!), but you could debug this fairly easily by inserting a print statement after every set_widget(), like so:

    form_pdg_test.set_widget(choice_heading, (0,10), colspan=100,rowspan=8)
    print 1
    form_pdg_test.set_widget(choice_question, (50,28), colspan=10,rowspan=7)
    print 2
    form_pdg_test.set_widget(checkbox_c, (43,36),colspan=16,rowspan=4)
    print 3
    # (...) etc
    

    Then you can see in the debug window what the last printed digit is, and you know that the next widget is the problem.

    Cheers!
    Sebastiaan

  • edited 2:54PM

    Hi Sebastian,

    Thank you very much for your quick response. I tried the solution you recommended, but still I can't fix the problem. All the numbers that I define in the print statements after each set_widget (in the prepare phase) are indeed printed in the debug window. However, there seems to be a problem with a widget (a warning message) that I call in the run phase of the inline script. But even when I delete this widget, the error message still occurs.
    Do you have another idea for me on how to fix the problem. And by the way: sorry for the mess in my code and the huge number of cells ;)!

    Cheers,
    Isabel

  • edited 2:54PM

    Hi Isabel,

    Right, I forgot that the geometry is only validated when you execute the form, so you wouldn't get this error after set_widget(). That's inconvenient. Could you post the full script, i.e. including the bits where you create the widgets and execute the form?

    Cheers,
    Sebastiaan

  • edited April 2014

    Hi Sebastian,

    Of course, please find the full script below.
    Thanks again for your help!

    Cheers,
    Isabel

    # Import the widgets library
    from libopensesame import widgets
    
    # Create the form
    form_pdg_test = widgets.form(self.experiment, cols=100, rows=76, margins=(0,0,0,0), spacing=0)
    
    # Create widgets
    choice_heading = widgets.label(form_pdg_test, text='<b><span size="20">Testdurchgang</span></b><br><br>Sie haben folgende Tabelle ausgewählt. Die Frage ist nun:<br><br><b>Welche Option wählen Sie?',center=True)
    choice_question = widgets.label(form_pdg_test, text='<span color="blue">Ich</span> wähle</b>',center=True)
    checkbox_c = widgets.checkbox(form_pdg_test, text='Option A',group="choice_test",var="choice_test")
    checkbox_d = widgets.checkbox(form_pdg_test, text='Option B',group="choice_test",var="choice_test")
    
    o_choice = widgets.label(form_pdg_test, text='<span color=#009900>Spieler 2</span> wählt')
    o_coop = widgets.label(form_pdg_test, text='Option A')
    o_defect = widgets.label(form_pdg_test, text='Option B')
    
    s_reward = widgets.label(form_pdg_test, text='<span color="blue">[PDG_R_test]</span>')
    s_temptation = widgets.label(form_pdg_test, text='<span color="blue">[PDG_T_test]</span>')
    s_sucker = widgets.label(form_pdg_test, text='<span color="blue">[PDG_S_test]</span>')
    s_punish = widgets.label(form_pdg_test, text='<span color="blue">[PDG_P_test]</span>')
    o_reward = widgets.label(form_pdg_test, text='<span color=#009900>[PDG_R0_test]+/-?</span>')
    o_temptation = widgets.label(form_pdg_test, text='<span color=#009900>[PDG_T0_test]+/-?</span>')
    o_sucker = widgets.label(form_pdg_test, text='<span color=#009900>[PDG_S0_test]+/-?</span>')
    o_punish = widgets.label(form_pdg_test, text='<span color=#009900>[PDG_P0_test]+/-?</span>')
    
    finished_button_mc= widgets.button(form_pdg_test, text="Weiter")
    
    # Add the widgets to the form.
    form_pdg_test.set_widget(choice_heading, (0,10), colspan=100,rowspan=8)
    form_pdg_test.set_widget(choice_question, (50,28), colspan=10,rowspan=7)
    form_pdg_test.set_widget(checkbox_c, (43,36),colspan=16,rowspan=4)
    form_pdg_test.set_widget(checkbox_d, (57,36),colspan=16,rowspan=4)
    form_pdg_test.set_widget(o_choice, (17,44), colspan=15, rowspan=4)
    form_pdg_test.set_widget(o_coop, (32,41), colspan=10, rowspan=4)
    form_pdg_test.set_widget(o_defect, (32,48), colspan=10, rowspan=4)
    form_pdg_test.set_widget(s_reward, (42,41), colspan=10, rowspan=2)
    form_pdg_test.set_widget(o_reward, (46,43), colspan=10, rowspan=2)
    form_pdg_test.set_widget(s_sucker, (42,48), colspan=10, rowspan=2)
    form_pdg_test.set_widget(o_temptation, (46,50), colspan=10, rowspan=2)
    form_pdg_test.set_widget(s_temptation, (56,41), colspan=10, rowspan=2)
    form_pdg_test.set_widget(o_sucker, (60,43), colspan=10, rowspan=2)
    form_pdg_test.set_widget(s_punish, (56,48), colspan=10, rowspan=2)
    form_pdg_test.set_widget(o_punish, (60,50), colspan=10, rowspan=2)
    form_pdg_test.set_widget(finished_button_mc, (45,60),colspan=10,rowspan=5)
    
    #define variables to implement warning message
    input_correct=False
    warning_text=""
    
    
    while input_correct==False:
        #execute form and wait for response
        button_clicked = form_pdg_test._exec()
    
        # get choice response
        choice_test = self.get("choice_test")
    
        #check if number is in correct range:
        if choice_test != "no":
            # if this is the case, set input_correct to True to exit the while loop
            input_correct=True
    
        # if this is not the case, specify appropriate warning text
        else: 
            warning_text="Bitte entscheiden Sie sich für Option A oder Option B."
    
  • edited 2:54PM

    Ok, it's these two:

    form_pdg_test.set_widget(checkbox_c, (43,36),colspan=16,rowspan=4)
    form_pdg_test.set_widget(checkbox_d, (57,36),colspan=16,rowspan=4)
    

    43 + 16 > 57, and therefore the two widgets overlap. Reducing the colspan for checkbox_c to 14 will do the trick. (However, aesthetically, I feel that there is more room for improvement!)

  • edited 2:54PM

    Dear Sebastian,

    Thank you very much for your help! That was a typical example of blindness...sorry!
    And, of course, you're right. Aesthetically, it can (and will) be further improved.

    Best regards,
    Isabel

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