Howdy, Stranger!

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

Supported by

AttributeError: 'Window' object has no attribute '_closed'

The experiment can run, but these errors and warnings have occurred, which may delay the process. How do I fix this? Help~

Comments

  • Hi @Ornella ,

    This seems like a bug in PsychoPy, and I suspect you're using an older version of OpenSesame (bundled with an older version of PsychoPy). Is that correct? If so, then I would update to the latest version of OpenSesame.

    Also, I don't think the error itself is necessarily a problem, because I suspect it occurs at the very end when the experiment closes, right?

    — Sebastiaan

  • Hi @sebastiaan,

    I have updated the version of OpenSesame. It works! Thank you very much!☺️😀

  • Hi, I am getting the same error, but with opensesame 4.0.32 and psychopy 2024.2.5.

    fyi I am trying to run an experiment where for speed reasons the canvases are drawn and stored in advance, and I get this error for every single canvas drawn, i.e. thousands of times per trial, so it kills the functionality of the experiment.

  • @jevrihanna Can you post the code that you use to create the canvases and the exact error message that you get?

  • edited February 21

    Hi @sebastiaan, the code is as follows. First a template canvas is created:

    # setup canvas and stimuli
    canvas = Canvas(color="gray")
    fix_pos = (0, ang2pix(7))
    fix_symb = "F" if follow else "S"
    canvas["fix"] = Text(fix_symb, x=fix_pos[0], y=fix_pos[1], color="black", font_size=72, font_bold=True)
    circle_kwargs = {"color":"black", "penwidth":14}
    
    # need to get the image size
    canvas["image"] = Image(pool[filename])
    image_size = canvas["image"].size
    circle_size = max(image_size)/2
    circle_size -= int(round(circle_size * circle_reduction))
    del canvas["image"]
    canvas["circle"] = Circle(0, 0, circle_size, **circle_kwargs)
    canvas["fix_circle"] = Circle(0, 0, circle_size, **circle_kwargs)
    
    # instructions
    instr_str = follow_str if follow else fix_str
    if practice:
        canvas["instructions"] = Text(f"{instr_str}\n\nFirst, keep your focus on the {fix_symb} below.", y=-ang2pix(6), color="black", font_size=48)
    
    # get basic parameters calculated
    img_width = image_size[0]
    left_point = -1 * (width // 2) - img_width // 2 - circle_kwargs["penwidth"]
    right_point = (width // 2) + img_width // 2 + circle_kwargs["penwidth"]
    sleep_time = 1#1000 / mon_refresh - 5
    
    # get the x coordinates 
    cur_x = 0.
    x_frames = []
    
    # left to centre
    while cur_x > left_point:
        x_frames.append(cur_x)
        cur_x -= pix_per_frame
    # flip the order to make it left to centre
    x_frames = x_frames[::-1]
    # centre to right 
    cur_x = 0.
    while cur_x < right_point:
        cur_x += pix_per_frame
        x_frames.append(cur_x)
    # flip if right to left
    if not left:
        x_frames = x_frames[::-1]
    canvas["circle"].x = x_frames[0]
    
    # block/trial info
    cur_trial += 1
    cur_block = (cur_trial // block_size) + 1
    print(f"{cur_trial} {cur_block}")
    

    Then we wait for eyetracker fixation:

    canvas.show()
    # wait for eyes to fixate for a certain period of time, and recalibrate if necessary
    if not wait_for_gaze(fix_pos, 2500, tolerance=32, gaze_timeout=10000):
        send_triggers(3,'Recalibration start')
        eyetracker.calibrate()
        eyetracker.start_recording()
        send_triggers(4,'Recalibration end')
        items.run(u"fixate")
        
    if practice:
        del canvas["instructions"]
    # replace instructional symbol with +
    del canvas["fix"]
    canvas["fix"] = Text("+", x=fix_pos[0], y=fix_pos[1], color="black", font_size=48, font_bold=True)
    canvas.show()
    # jittered delay
    clock.sleep(random.randint(jitt_low, jitt_high))
    

    Then the canvas is iteratively copied with small translational changes to one object

    start_time = clock.time()
    canvases = []
    ## move the stimuli across the screen
    revealed= False
    ur_canvas = canvas
    for x_idx, x_f in enumerate(x_frames):
        this_canvas = Canvas()
        this_canvas.copy(ur_canvas)
        if x_f == 0.: # centre
            revealed = True
            zero_idx = x_idx
            # this if-else makes the moving image overlap the still image during SP,
            # and reversed if fixation
            if follow:
                this_canvas["fix_stimulus"] = Image(pool[filename])
                this_canvas["stimulus"] = Image(pool[filename])
            else:
                this_canvas["stimulus"] = Image(pool[filename])
                this_canvas["fix_stimulus"] = Image(pool[filename])
        if revealed:
            this_canvas["stimulus"].x = x_f
        this_canvas["circle"].x = x_f
        canvases.append(this_canvas)
        ur_canvas = this_canvas
    stop_time = clock.time()
    print(stop_time-start_time)
    
    
    

    This error message is repeated 100s of times:

    AttributeError: 'Window' object has no attribute '_closed'Exception ignored in: <function Window.__del__ at 0x7f727ebed040>
    
    Traceback (most recent call last):
    
     File "/home/stimulus/miniconda3/envs/2025SP1/lib/python3.9/site-packages/psychopy/visual/window.py", line 664, in __del__
    
       if self._closed is False:
    


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