Howdy, Stranger!

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

Supported by

trying to show random images in an invisible circle


I want to randomly present 6 photos from two different lists in an invisible circle at equal distance from each other, but the code does not work. Can you help me find what the error is and fix it?

Experiment is attached.

Thanks in advance,



  • Hi @bssengul,

    I'm no expert in Python but I had a lok at your task and did a few searches. The error message in the console should help you track the issue (it even indicates what line contains the problematic code. (Also, to confirm it, you can remove code and inserting it back progressively to identify what line generates the error exactly)

    Ifg you check the error message, you'll see that the issue is with this line of code:

     var.x1, var.y1 = var.img1

    This generates the following error:

    Traceback (most recent call last):

     File "<circle.prepare>", line 15, in <module>

    ValueError: too many values to unpack (expected 2)

    If you look up the meaning of this error on the internet, you'll find that this error comes up when is due to the function xy_from_polar returning more than two values. In Python, when you write var.x1, var.y1 = var.img1, it expects var.img1 to be a sequence of exactly two items. The error "too many values to unpack" implies that the var.img1 contains more than two items. Now, the thing is that if you check what var.img1 contains it by printing it to the console, you'll see that it actually does contain 2 elements, so the error Python generates does not provide an accurate description in this case. I suspect that it has to do with the way Open Sesame handles things, addind some layer of procesing on top of Python when it comes to handling variables.

    The good news is that playing around a little reveales a simple fix. Just replace:

    var.img1 = xy_from_polar(var.imgDist, var.imgAng1)
    var.x1, var.y1 = var.img1


    var.x1, var.y1 = xy_from_polar(var.imgDist, var.imgAng1)

    You'd have to do the same with img2 to img6. This method not only simplifies your code but also helps to avoid any confusion about variable assignments.

    You'll then have to push the images onto the canvas before you show it. Because your command is the last event in the task, you won't actually see anything (the task will end at the same time as the canvas is displayed). So you need to add something afterwards (e.g., a keyboard response event). Finally, better write your Python code under the run tab than uder the prepare tab (otherwise the timing of the events in your trial will be messed up).

    Here's my edited version that solves the coding issue and displays the pictures before taking a keyboard response.

    Note taht given the size of your pictures, the x,y coordinates will need to be adapted (or the sice of your pictures), as they overlap spatially.

    Hope this helps!


    Buy Me A Coffee

  • Hi Fabrice, it was very helpful for me to understand. thank you so much!


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