Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

typeerror #886

Open
ZakiuC opened this issue May 20, 2022 · 9 comments
Open

typeerror #886

ZakiuC opened this issue May 20, 2022 · 9 comments

Comments

@ZakiuC
Copy link

ZakiuC commented May 20, 2022

Traceback (most recent call last):
File "H:\Program Files\Python310\lib\site-packages\labelImg\labelImg.py", line 965, in scroll_request
bar.setValue(bar.value() + bar.singleStep() * units)
TypeError: setValue(self, int): argument 1 has unexpected type 'float'

@xbeheydt
Copy link

xbeheydt commented Jun 2, 2022

I have the same issue when I scroll in image.

Traceback (most recent call last):
  File "/home/username/.local/pipx/venvs/labelimg/lib/python3.10/site-packages/labelImg/labelImg.py", line 965, in scroll_request
    bar.setValue(bar.value() + bar.singleStep() * units)
TypeError: setValue(self, int): argument 1 has unexpected type 'float'
[1]    1433121 IOT instruction (core dumped)  labelImg

Same problem when I create a box :

Traceback (most recent call last):
  File "/home/username/.local/pipx/venvs/labelimg/lib/python3.10/site-packages/libs/canvas.py", line 530, in paintEvent
    p.drawLine(self.prev_point.x(), 0, self.prev_point.x(), self.pixmap.height())
TypeError: arguments did not match any overloaded call:
  drawLine(self, QLineF): argument 1 has unexpected type 'float'
  drawLine(self, QLine): argument 1 has unexpected type 'float'
  drawLine(self, int, int, int, int): argument 1 has unexpected type 'float'
  drawLine(self, QPoint, QPoint): argument 1 has unexpected type 'float'
  drawLine(self, Union[QPointF, QPoint], Union[QPointF, QPoint]): argument 1 has unexpected type 'float'
[1]    1433698 IOT instruction (core dumped)  labelImg

@xbeheydt
Copy link

xbeheydt commented Jun 2, 2022

Looking at the code, I seem to have seen a fix about this? When is the next release scheduled? Thanks

@nine
Copy link
Contributor

nine commented Jun 9, 2022

@xbeheydt can you post the patch?

@nine
Copy link
Contributor

nine commented Jun 9, 2022

This issue is a possible duplicate with #885.

@ptiszai
Copy link

ptiszai commented Nov 9, 2022

Solution.
Error in Qt5.
float to int conversion
Changed:
x:\xxxxx\python-310\Lib\site-packages\libs\canvas.py
526 line:
default:
p.drawRect(left_top.x(), left_top.y(), rect_width), int(rect_height)
new:
p.drawRect(int(left_top.x()), int(left_top.y()), int(rect_width), int(rect_height))
530 line:
default:
p.drawLine( self.prev_point.x(), 0, self.prev_point.x(), self.pixmap.height())
new:
p.drawLine( int(self.prev_point.x()), 0, int(self.prev_point.x()), int(self.pixmap.height()))
531 line:
default:
p.drawLine( 0, self.prev_point.y(), self.pixmap.width(), self.prev_point.y())
new:
p.drawLine( 0, int(self.prev_point.y()), int(self.pixmap.width()), int(self.prev_point.y()))
Changed:
x:\xxxxx\python-310\Lib\site-packages\labelImg\labelImg.py
965 line:
default:
bar.setValue(bar.value() + bar.singleStep() * units)
new:
bar.setValue(int(bar.value() + bar.singleStep() * units))

Good work.

@daudhiyaa
Copy link

Please refer to this comment

@bedead
Copy link

bedead commented Mar 11, 2023

Thank you, that worked for me.

@pt010104
Copy link

3/13/2023, Your anwer still works, thanks!!!

@ptiszai
Copy link

ptiszai commented Mar 13, 2023

Thank you, that worked for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants