Hello Community, I try to implement Zoom Window and Select Area using Mouse+SHIFT but this code from class qtviewer3d doesn't work for me.
So, I changed the following code: # Draw rect def DrawBox( self , event): tolerance = 2 pt = point( event.pos() ) dx = pt.x - self.dragStartPos.x dy = pt.y - self.dragStartPos.y if abs( dx ) <= tolerance and abs( dy ) <= tolerance: return painter = QtGui.QPainter() painter.begin(self) painter.setPen(QtGui.QPen(QtGui.QColor(255,255,255), 1, QtCore.Qt.DotLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin)) rect = QtCore.QRect(self.dragStartPos.x, self.dragStartPos.y, dx, dy ) self._drawbox = [self.dragStartPos.x, self.dragStartPos.y , dx, dy] painter.drawRect( rect ) self.repaint() painter.end() # and mouse release event def mouseReleaseEvent( self, event ): self.setCursor( self.crossNormalBitmapCursor ) pt = point(event.pos()) #print 'mouse release event' if event.button() == QtCore.Qt.LeftButton: pt = point(event.pos()) self.repaint() if self._select_area: [Xmin, Ymin, dx, dy] = self._drawbox selected_shapes = self._display.Select(Xmin,Ymin,Xmin+dx,Ymin+dy) self._select_area = False elif self._display.Select(pt.x,pt.y): selected_shape = self._display.GetSelectedShape() print selected_shape,selected_shape.ShapeType() # This part comes here !!! elif event.button() == QtCore.Qt.RightButton: if self._zoom_area: [Xmin, Ymin, dx, dy] = self._drawbox self._display.ZoomArea(Xmin, Ymin, Xmin+dx, Ymin+dy) self._zoom_area = False # and I set following Attribute #self.setAttribute(QtCore.Qt.WA_PaintOutsidePaintEvent) class qtViewer3d( qtBaseViewer ): def __init__( self, *kargs ): qtBaseViewer.__init__( self, *kargs ) self._drawbox = False self._zoom_area = False self._select_area = False self._inited = False self._leftisdown = False self._middleisdown = False self._rightisdown = False self._selection = None self._drawtext = True # Very Important self.setAttribute(QtCore.Qt.WA_PaintOutsidePaintEvent) So, for now it works Zoom Window if I use RMB+SHIFT, but Select Area (LMB+SHIFT) still not working. hier is output from console: Traceback (most recent call last): File "", line 656, in mouseReleaseEvent selected_shapes = self._display.Select(Xmin,Ymin,Xmin+dx,Ymin+dy) TypeError: Select() takes exactly 3 arguments (5 given) Traceback (most recent call last): File " ", line 655, in mouseReleaseEvent [Xmin, Ymin, dx, dy] = self._drawbox TypeError: 'bool' object is not iterable I do not know how to fix this error. I am using Debian GNU/Linux "squeeze". _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users