Layout issues for grouped items using rating scale
Dear all openSesame enthusiasts!
Maybe one could help me solving a layout problem. Do you know a trick to align the item text (bottom line) at the same height as the checkboxes of the rating scale?
I tried to combine the RatingScale with Text within a form. Thanks to Sigmund.ai, that has optimized the code I got (unfortunately) only the solution you can see in the figure attached to my post.
Thanks for the support, that I appreciate very much!
All the best,
F.
Code of inline_skript:
# START_PREPARE_PHASE # ───────────── PREPARE PHASE ───────────── statements = [ u"Ich beschäftige mich in meiner Freizeit viel mit musikbezogenen Aktivitäten.", u"Ich kann leicht Melodien wiedererkennen.", u"Musik ist mir wichtiger als vielen anderen Menschen.", u"Ich kann einen Song nach einigen Takten wiedererkennen.", u"Ich singe häufig oder summe Melodien." ] n_items = len(statements) rows = [1] * n_items + [2, 1] # 1 Zeile pro Item | Leerzeile | Button form = Form( cols=[2, 4], # ursprüngliche Spaltenbreite rows=rows, margins=(60, 60, 60, 60), # Standard-Margins spacing=0, # minimaler Horizontalabstand theme='gray', timeout=30000 ) # Skalen rs_labels = [ u"Stimme<br>ganz und gar nicht zu<br>", u"Stimme<br>nicht zu<br>", u"Stimme<br>eher nicht zu<br>", u"<br>Weder noch<br>", u"Stimme<br>eher zu<br>", u"Stimme<br>zu<br>", u"Stimme<br>voll und ganz zu<br>" ] scales = [ RatingScale(nodes=rs_labels, orientation='horizontal', click_accepts=False, var='GoldMSI1'), RatingScale(nodes=7, orientation='horizontal', click_accepts=False, var='GoldMSI2'), RatingScale(nodes=7, orientation='horizontal', click_accepts=False, var='GoldMSI3'), RatingScale(nodes=7, orientation='horizontal', click_accepts=False, var='GoldMSI4'), RatingScale(nodes=7, orientation='horizontal', click_accepts=False, var='GoldMSI5') ] # Widgets einsetzen row_idx = 0 for txt, scale in zip(statements, scales): form.set_widget(Label(text=u"<br>" + txt, center=False), (0, row_idx)) form.set_widget(scale, (1, row_idx)) row_idx += 1 # Leerzeile + Button next_btn = Button(text=u"Weiter") form.set_widget(next_btn, (0, len(rows)-1), colspan=2) # START_RUN_PHASE # ─────────────── RUN PHASE ─────────────── form._exec(focus_widget=scales[0])
Comments
Hi @platzf
If I understand correctly, the text is aligned with the top of the checkboxes by default, and you’d like it to align with the bottom line instead; is that right?
One possible workaround I found is to fine-tune the linebreak by adding a styled non-breaking space before the statement text. Something like this:
Depending on your font size and experiment settings, you can play with the font-size parameter to get just the right visual alignment.
Let me know if that works for you!
Best,
Claire
Check out SigmundAI.eu for our OpenSesame AI assistant! 🤖
Dear @cvanbuck
thank you very much for your suggestions. However, it did not work. Therefore I tried another approach, but unfortunately with other problems (mainly that response categories stored with the statements of my items were not presented but instead the statement again...).
Best,
Friedrich
Hi @platzf
Could you please share your OpenSesame experiment file (.osexp) so that I can take a closer look? The above "trick" worked for me, so it would help to see your experiment's settings and structure.
Cheers,
Claire
Check out SigmundAI.eu for our OpenSesame AI assistant! 🤖