Skip to content

pygame-ce 2.5.2 no longer provides window.grab #1

@fire-eggs

Description

@fire-eggs

Installed pygame-ce, turns out to be V2.5.2. Kept running into this error:
AttributeError: 'pygame.window.Window' object has no attribute 'grab'.

Made the following changes to core/common/utils.py, starting at line 438:

def enable_virtual_mouse():
    #cr.window.grab = True
    cr.window.grab_mouse = True
    pg.mouse.set_visible(False)


def disable_virtual_mouse():
    #cr.window.grab = False
    cr.window.grab_mouse = False
    pg.mouse.set_visible(True)


def is_enabled_virtual_mouse():
    #return cr.window.grab and not pg.mouse.get_visible()
    return cr.window.mouse_grabbed and not pg.mouse.get_visible()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions