Created
November 15, 2024 06:42
-
-
Save sonsongithub/ae04d8324f350a8a05b84985473ca1f6 to your computer and use it in GitHub Desktop.
Avoid labelImg from crashing when creating annotaion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- canvas.original.py 2024-11-09 01:08:48 | |
+++ canvas.py 2024-11-09 01:09:31 | |
@@ -523,12 +523,12 @@ | |
p.setPen(self.drawing_rect_color) | |
brush = QBrush(Qt.BDiagPattern) | |
p.setBrush(brush) | |
- p.drawRect(left_top.x(), left_top.y(), rect_width, rect_height) | |
+ p.drawRect(int(left_top.x()), int(left_top.y()), int(rect_width), int(rect_height)) | |
if self.drawing() and not self.prev_point.isNull() and not self.out_of_pixmap(self.prev_point): | |
p.setPen(QColor(0, 0, 0)) | |
- p.drawLine(self.prev_point.x(), 0, self.prev_point.x(), self.pixmap.height()) | |
- p.drawLine(0, self.prev_point.y(), self.pixmap.width(), self.prev_point.y()) | |
+ p.drawLine(int(self.prev_point.x()), 0, int(self.prev_point.x()), int(self.pixmap.height())) | |
+ p.drawLine(0, int(self.prev_point.y()), int(self.pixmap.width()), int(self.prev_point.y())) | |
self.setAutoFillBackground(True) | |
if self.verified: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- labelImg.original.py 2024-11-09 01:08:27 | |
+++ labelImg.py 2024-11-09 01:08:33 | |
@@ -962,7 +962,7 @@ | |
def scroll_request(self, delta, orientation): | |
units = - delta / (8 * 15) | |
bar = self.scroll_bars[orientation] | |
- bar.setValue(bar.value() + bar.singleStep() * units) | |
+ bar.setValue(int(bar.value() + bar.singleStep() * units)) | |
def set_zoom(self, value): | |
self.actions.fitWidth.setChecked(False) |
Author
sonsongithub
commented
Nov 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment