Skip to content

Fix TypeError when using middle-click scroll in GNS3 3.0.6 with Python 3.13 #3851

Description

@pavel-gorin

Environment

  • OS: Debian (Trixie)
  • Python: 3.13.5
  • GNS3: 3.0.6 (installed via pipx)

Problem

When pressing the middle mouse button in the topology view, GNS3 throws a traceback:

Traceback (most recent call last):
File ".../gns3/graphics_view.py", line 637, in mouseMoveEvent
hBar.setValue(hBar.value() + (delta.x() if QtWidgets.QApplication.isRightToLeft() else -delta.x()))
TypeError: setValue(self, a0: int): argument 1 has unexpected type 'float'

Same for vertical scroll at line 639:
File ".../gns3/graphics_view.py", line 639, in mouseMoveEvent
vBar.setValue(vBar.value() - delta.y())
TypeError: setValue(self, a0: int): argument 1 has unexpected type 'float'

Root cause

PyQt's setValue() expects int, but delta.x() and delta.y() return float in Python 3.13.

Proposed fix

Wrap arguments in int():

hBar.setValue(int(hBar.value() + (delta.x() if QtWidgets.QApplication.isRightToLeft() else -delta.x())))
vBar.setValue(int(vBar.value() - delta.y()))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions