Howdy, Stranger!

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

Supported by

[open] Formatting Forms with Python Inline Scripts

edited March 2013 in OpenSesame

Hello,

I am in the process of making a form for judging images in a pilot study. So far, I've found programming with the form and widget library very simple, but I haven't been able to find support documentation for one problem.

Problem: I cannot figure out how to customize the colors of the form.

It seems like it should be fairly straightforward.

Thanks for any help in advance!

-Alex

Comments

  • edited 11:54PM

    Hi Alex,

    Forms inherit the colors and font specified in the general tab of the experiment. If you want to have different colors for each form, you need to modify the experiment background and foreground during the experiment, before the form is constructed. You can do this by inserting an inline_script item before your form, with the following code in the prepare phase:

    exp.set('foreground', 'yellow')
    exp.set('background', 'blue')
    

    Of course, you can use any color you like here. Note that the new colors will apply to all items that are constructed from this point onward!

    Btw, if you simply want to add some formatting to your text, you could also use the HTML subset:

    Cheers!
    Sebastiaan

  • edited 11:54PM

    Hello Sebastiaan,

    I knew it would be a simple fix, many thanks!

    One more question, if you don't mind:

    How are the prepare and run code sections of an inline_script item related? It seems like most of the code one writes for items like stimulus displays should be placed in the body of Prepare; what examples of code are best placed in the body of Run?

    Thanks!
    Alex

    P.S. - I am very impressed with the flexibility and power of OpenSesame. I tried to learn PsychoPy, and had a rough go of it, but OpenSesame, and libopensesame are so intuitive, it took me about an hour to get a pretty complex program running. Bravo!

  • edited 11:54PM

    P.S. - I am very impressed with the flexibility and power of OpenSesame.

    Thanks!

    How are the prepare and run code sections of an inline_script item related?

    When a sequence item is executed, every item in it is called twice: First the prepare() function is called for every item (the prepare phase), and then the run() function is called for every item (the run phase). The idea is that items do as much as possible during the prepare phase, so that the run phase is as efficient as possible. For example, a sketchpad item constructs its canvas during the prepare phase, which is time consuming, and only calls the canvas.show() function during the run phase. Sometimes it's not possible to prepare things in advance, because they depend on what happens during the sequence (for example the participant's response). In that case, more work is shifted to the run phase, generally at the cost of introducing extra lag.

    So this is the general logic behind the two phases. In an inline_script you can in principle do whatever you want, but it's good practice to keep the above distinction in mind.

  • edited 11:54PM

    Thank you for explaining.

    So then, in principle, you should place all your code in the prepare() phase, and OpenSesame decides which portions to execute at runtime and which to execute prior to runtime; but if you know beforehand that one portion of code will be dependent on another event in the sequence, then you should just go ahead and place that code in the run() phase?

    I just want to be clear on this so that I know when I might encounter undesirable latency in stimulus presentations.

  • edited 11:54PM

    So then, in principle, you should place all your code in the prepare() phase

    As much preparatory code as possible, yes, but not the code that directly controls stimulus presentation etc. For example, you would load a sound file in the prepare phase, but play it in the run phase. Similarly, you would construct a canvas in the prepare phase, and then show() it in the run phase.

    OpenSesame decides which portions to execute at runtime and which to execute prior to runtime;

    OpenSesame does not auto-detect which code to run when, if that's what you mean? You control this explicitly by putting your code into the prepare or run phase.

    but if you know beforehand that one portion of code will be dependent on another event in the sequence, then you should just go ahead and place that code in the run() phase?

    Yes!

  • edited 11:54PM

    Ok, great! Thank you for explaining :)

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