如何在(df$B <- Reduce(paste, as.character(df$A), accumulate = TRUE))
# [1] "banana" "banana boats" "banana boats are" "banana boats are awesome"
上将2D numpy.ndarray
显示为像素值的集合?如果我没有尝试制作GUI,通常会使用QGraphicsView
。
pylab.imshow()
我的尝试:
frame = array([[ 56., 57., 58., ..., 58., 58., 58.],
[ 52., 58., 58., ..., 56., 57., 59.],
[ 56., 55., 58., ..., 57., 57., 58.],
...,
[ 53., 55., 55., ..., 54., 54., 53.],
[ 54., 57., 56., ..., 53., 54., 59.],
[ 55., 57., 54., ..., 56., 58., 57.]])
scene = QGraphicsScene(self)
scene.addPixmap(QPixmap.fromImage(qimage2ndarray.array2qimage(frame)))
view = self.graphicsView(scene, self) # Error from this line
self.graphicsView = QtGui.QGraphicsView(scene, self)
view.show()
。我想专门将场景添加到由QT Designer生成的名为TypeError: 'QGraphicsView' object is not callable
的{{1}}。如果我用以下
QGraphicsView
然后显示图像,但在graphicsView
的左上角显示我的其他小部件。如何将展示位置限制为特定view = QtGui.QGraphicsView(scene, self)
?
答案 0 :(得分:0)
在我身边找到这个简约的解决方案:
scene = QGraphicsScene(self)
scene.addPixmap(QPixmap.fromImage(qimage2ndarray.array2qimage(frame)))
self.graphicsView.setScene(scene)