Skip to content

ValueError when trying to plot 2D histogram items with PyQt6 #34

@michael-miftek

Description

@michael-miftek

In {plotpy_dir}\items\image\base.py Line 604 - 606 part of BaseImageItem.draw_image()

dest = _scale_rect(
            self.data, src_rect, self._offscreen, dst_rect, self.lut, self.interpolate
        )

There is an issue when using the 2d histogram example that produces the following error.

File "C:\Users\Username\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotpy\items\image\base.py", line 604, in draw_image
    dest = _scale_rect(
           ^^^^^^^^^^^^
ValueError: Error calling Python override of QFrame::paintEvent(): Invalid destination rectangle (expected tuple of 4 integers)

This Error ends up leaving the painter object open causing a crash, after finding the location changing the dst_rect -> tuple(map(int, dst_rect)) fixes the problem but wanted to make someone aware since it is expected as tuple[float, float, float, float].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions