Howdy, Stranger!

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

Supported by

[open] changing property of an item in a sketchpad at runtime

edited May 2015 in OpenSesame

I am trying to find a way to change/update some sketchpad's items with an inline script which runs right after the sketchpad (duration 0), but I guess there is no easy way to access a sketchapd' sub-items property, so fo now I'm using (a lot of) variables inside the sketchpad'script like this:

draw textline -192 -224 "[text1]" center=1 color="white" font_family="mono" font_size=[fontSize] font_bold="[doBold]" font_italic="no" html="yes" z_index=0 show_if="always"

the most useful would be looping trough all the items and accessing each item as if it was a single object, with its properties, and change them. A sort of of:

for myItem in exp.items['mySketchpad'] : 
    if myItem.name == "my_textline":
        myItem.text="newtext"

thanks

Comments

  • edited 10:16PM

    Hi,

    It's not easy to change the contents of a sketchpad by accessing the item in the way you're doing now. However, what you could do is create a canvas object that is a copy of a sketchpad, and work on that. For example, you could create a copy of mySketchpad and add a fixation dot like so:

    c = self.copy_sketchpad('mySketchpad')
    c.fixdot()
    c.show()
    

    See also:

    Does that help at all?

    Cheers,
    Sebastiaan

  • edited 10:16PM

    Ehm.. yes and no. In the meaning that I am already trying that way.

    I thought that from InlineScript it would be possible to access the internals and working directly with the objects themselves without doing a lot of variable declarations and going strighlty to the solution in a no complicated way.

    But ok, I guess it's just a matter of "know-how-things-works"

    thanks for your help

  • edited 10:16PM

    E.g., which is my problem now.

    I have a sketchpad (duration 0) with a lots of items (texts and rects) defined in a way that they should appear upon a user response.

    So each item has a show_if="['var1'] =='yes'" condition.

    The way I found to reload the sketchpad and its item, showing or not is putting inside a sequence:

    mySequence
    --- Sketchpad
    --- inLineScript
    

    inside the inLineScript there are these lines:

    exp.set('var1','yes')
    exp.items['mySequence'].prepare()
    exp.items['mySequence'].run()
    

    and yes, it works but takes some time to reload.

    I like the c = self.copy_sketchpad('mySketchpad') approach instead which is fast but I don't know how to switchOn those items that are initially "hidden" .

    thanks!

  • edited 10:16PM

    I think that is actually a good solution, and quite easy to implement.

    and yes, it works but takes some time to reload.

    That's because the whole canvas is regenerated. This takes some time, especially on the hardware-accelerated backends (xpyriment and psycho). Does it go faster if you switch to the legacy backend?

    Cheers,
    Sebastiaan

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