Howdy, Stranger!

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

Supported by

click on words and display meaning


I have to create an experiment and would like to know if it is possible to realize it with opensesame. I would like to present a text and give the participants the possibility to click on a certain word. By clicking on the word, the meaning of the word will be displayed in the form of a sentence. Afterwards the participant should have the possibility to continue reading the text. Can someone tell me if this is possible and if so, how?

Thanks you for your help


  • Hi Sabrina,

    This sounds like it is possible, but it will be a little tricky and requires quite a bit of inline coding. Potential problems/labor-intense parts:

    1) You have to have a dictionary entry for each word

    2) You have to split the screen in fields for every word, which depending on how long the text is, could be difficult.

    Maybe you can give an example of what text you would have in mind? If you can reduce the complexity of the design (shorter text, and/or only a subset of the words have an explanation), it might be possible to implement this.


    Buy Me A Coffee

  • Hi Eduard,

    1) I have an entry vor each word.The structure of the dictionary entry should contain the target word e.g. Rivalität (rekabet, yarisma) and an associated synonym such as competition and an explanatory sentence such as: Two people want the same thing and argue about it.

    2) the text consists of max 300 words and contains 11 target words that occur once or twice in the text. These words should be clickable just in case the children, if they do not know the word, can click on it and the meaning will be displayed.

    The text can be split on two or three pages, i.e. the text does not have to be visible in its entirety at once.

    Here is an extract of the text: "Sie ist ein typisches Mädchen, das gerne mit Puppen spielt, eben ganz feminin. Damit kann Nils nichts anfangen und schon gar nichts mit ihrem impertinenten Verhalten. Er will auch einmal die volle Aufmerksamkeit der Eltern bekommen. Dementsprechend groß ist die Rivalität unter den Geschwistern."

    My idea would have been to use a button in a form_base for the target words, but I think you probably have a better idea.

    Thanks a lot for your help.

    Best Sabrina

  • Yes,

    I see why would think buttons could work, and I think they could work, but not without causing noticeable offsets/unnatural spacing in your text. If this doesn't matter, I can try to tinker together a little template that you could extend. If you want a smooth text, this will be somewhat more work. Given 1)< I think it will be possible to program it in a reasonable efficient way. Essentially, the "hard" work will be to program the clicking interaction, not the text itself. So if you get started and make a working template, we can start from there to make it work.

    Does that make sense?


    Buy Me A Coffee

  • Hi Eduard,

    I have started an attempt with an inline script item. Here it is.

    Sometimes the words look a little bit displaced, which is caused by certain letters such as a "g". So a word with a "g" in it slides higher than one without. So I put an invisible g behind some words to make it look like they are on a line. Do you know what  I mean and is there maybe another solution for this?  I have tried all fonts, but it is the same with each one.

    Do you know the exact color code (#.....) of the buttons? If I need an invisible "g" here, and use the color name grey in f.set_widget(Button(text='impertinenten<span style="color:grey;">g</span>', var=u'impertinent'), (11, 7), colspan=3), then the “g” is visible, because it is not the same color.

    I have thought about the buttons and the dictionary entries that should appear. I have already created a questionnaire with Opensesame, where a warning message via sketchpad was displayed to the participants if they did not fill the rating scale. Can I use the opposite of this syntax for my current problem?

    In the way that if no button is pressed, no entry appears, but if one is pressed, the entry should appear like the warning message in my first questionnaire . If it’s possible, then I would need some help with this syntax and please excuse my many questions.

    Thanks again for your help


  • Hi Sabrina,

    that looks promising!

    color code


    Dictionary stuff

    I think in order to implement the dictionary I would use the same logic that you used for the back button in your form. So basically, if a button was pressed, check which button that was, show the form that corresponds with that dictionary entry, and include a back button that will bring you back to the text. Does that make sense?

    weird spacing

    Hm, I thought so. I think you have two alternatives here. 1) Find a font that has the same size vertically for all letters (I don't know any, google will help) 2) Don't use proper buttons, but try to extract the position of the text fields on the canvas, and implement your own "button" like feature (define an ROI around the words, check whether a mouse click was within the bounds of that ROI, and take actions from there one). If you choose this option, you might not need to use forms at all.

    Aside from that, I would advice that you keep the form definitions and exection separate, former in the prepare phase, latter in the run phase. This might keep things more organized.

    Good luck,


    Buy Me A Coffee

  • Hi, Eduard,

    thanks for your quick reply. I have now put the definitions into the prepare phase and the executions into the run phase and created the other forms for the dictionary entries. I’m sorry, but I can't adapt the syntax with the back-buttons without help, because i don't understand it in its entirety. Could you help me with that?

    It should be possible to press the same button several times, this is possible or? Additionally the back button should remain, so that the participants can go back from the second page to the first page. Lastly, I have one more question. Can I measure how often one of these buttons were pressed?

    And again thanks in advance. ๐Ÿ˜€

  • edited April 2020

    HI Sabrina,

    Most of it seems to work. I can press all the buttons and the show information as they should (sometimes), but it seems that there are some dependencies between the clicks, which suggests there are some minor mistakes with the naming of the variables. I simplified your code a bit and removed some little mistakes (typos, etc.). The form should now work as you intended it to. (Two tiny remarks: I would give the forms more descriptive labels. And, the buttons seem to be to big? For some of them you seem to be able to only click on part of it to see an effect. Is that possible?)

    Can I measure how often one of these buttons were pressed?

    That is possible. My suggestion is included in the experiment.

    Buy Me A Coffee

  • Hi Eduard,

    thanks for your help. Now everything works it's supposed to. I have one more question. The debug window shows me the number of clicks, thats great. But is there a possibility to save them in the .csv file? I have added a logger item and also manually added the variable to the logger item, but there is only a "no" for the buttons leading to the dictionary entries and a "yes" for the back buttons of the dictionary entries.

    best, Sabrina

  • Hi Sabrina,

    Can you add these lines in the end of your script?

    for k,v in number_of_clicks.items():

    This makes a variable starting with "number_clicks", and ending with the specific button. In general, only variables are logged that are either set with exp.set(), or prepended with a var.

    Good luck,


    Buy Me A Coffee

  • Hi Eduard,

    it works, thanks again ๐Ÿ˜


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