Skip to content

[Bug]: pick events do not forward mouseevent-key on Linux #24199

@raphaelquast

Description

@raphaelquast

Bug summary

Somehow on CentOS Linux 7 keyboard-buttons are not forwarded with pick_events... on Windows 10 everything works as expected.

Code for reproduction

import matplotlib.pyplot as plt

f, ax = plt.subplots()
s = ax.scatter([1,2,3,4], [1,2,3,4], s=1000)
s.set_picker(True)

def doit(event):
    if event.name == "button_press_event":
        print(event.name, event.key)
    if event.name == "pick_event":
        print(event.name, event.mouseevent.key)

f.canvas.mpl_connect("button_press_event", doit)
f.canvas.mpl_connect("pick_event", doit)

Actual outcome

When clicking on one of the datapoints while pressing the buttons 1 2 and 3 the following happens:

on Windows I get:

pick_event 1
button_press_event 1
pick_event 2
button_press_event 2
pick_event 3
button_press_event 3

on CentOS Linux I get:

pick_event None
button_press_event 1
pick_event None
button_press_event 2
pick_event None
button_press_event 3

Expected outcome

The same output for both OS

Operating system

Windows / Linux CentOS7

Matplotlib Version

3.6.1

Matplotlib Backend

Qt5Agg

Python version

3.9.13

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions