Skip to content

Button parameter for mouse functions not correctly mapped to enum #349

@Mambouna

Description

@Mambouna

While writing controller support for PGZero, I noticed that the behaviour described in the documentation string of prepare_handler in game.py does not seem to be correct. It states:

The wrapped handler will also map certain parameter values using callables from EVENT_PARAM_MAPPERS; this ensures that the value of 'button' inside the handler is a real instance of constants.mouse, which means (among other things) that it will print as a symbolic value rather than a naive integer.

The values given to the mouse functions being proper values of the mouse enum does not appear to be the case however. When running the following simple example with pgzrun, only normal integer values are printed.

def on_mouse_down(button):
    print(button)

I must admit I don't currently understand how prepare_handler really works, so I don't think I can fix this myself.

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