HoverEvent — pyqtgraph 0.9.8 documentation

### Navigation

- index
- modules |
- next |
- previous |
- pyqtgraph 0.9.8 documentation »
- API Reference »
- GraphicsScene and Mouse Events »

# HoverEvent

class `pyqtgraph.GraphicsScene.mouseEvents.` `HoverEvent`(moveEvent, acceptable)

  Instances of this class are delivered to items in a `GraphicsScene` via their hoverEvent() method when the mouse is hovering over the item. This event class both informs items that the mouse cursor is nearby and allows items to communicate with one another about whether each item will accept potential mouse events.

  It is common for multiple overlapping items to receive hover events and respond by changing their appearance. This can be misleading to the user since, in general, only one item will respond to mouse events. To avoid this, items make calls to event.acceptClicks(button) and/or acceptDrags(button).

  Each item may make multiple calls to acceptClicks/Drags, each time for a different button. If the method returns True, then the item is guaranteed to be the recipient of the claimed event IF the user presses the specified mouse button before moving. If claimEvent returns False, then this item is guaranteed NOT to get the specified event (because another has already claimed it) and the item should change its appearance accordingly.

  event.isEnter() returns True if the mouse has just entered the item’s shape; event.isExit() returns True if the mouse has just left.

  `acceptClicks`(button)

    Inform the scene that the item (that the event was delivered to) would accept a mouse click event if the user were to click before moving the mouse again.

    Returns True if the request is successful, otherwise returns False (indicating that some other item would receive an incoming click).

  `acceptDrags`(button)

    Inform the scene that the item (that the event was delivered to) would accept a mouse drag event if the user were to drag before the next hover event.

    Returns True if the request is successful, otherwise returns False (indicating that some other item would receive an incoming drag event).

  `buttons`()

    Return the buttons currently pressed on the mouse. (see QGraphicsSceneMouseEvent::buttons in the Qt documentation)

  `isEnter`()

    Returns True if the mouse has just entered the item’s shape

  `isExit`()

    Returns True if the mouse has just exited the item’s shape

  `lastPos`()

    Return the previous position of the mouse in the coordinate system of the item that the event was delivered to.

  `lastScenePos`()

    Return the previous scene position of the mouse.

  `lastScreenPos`()

    Return the previous screen position of the mouse.

  `modifiers`()

    Return any keyboard modifiers currently pressed. (see QGraphicsSceneMouseEvent::modifiers in the Qt documentation)

  `pos`()

    Return the current position of the mouse in the coordinate system of the item that the event was delivered to.

  `scenePos`()

    Return the current scene position of the mouse.

  `screenPos`()

    Return the current screen position of the mouse.

### Navigation

- index
- modules |
- next |
- previous |
- pyqtgraph 0.9.8 documentation »
- API Reference »
- GraphicsScene and Mouse Events »