1
pyqtgraphに問題があり、私の理解が不十分だと思います。 pyqtデザイナーウィンドウ内に「ImageItem」を埋め込むためのコードがあります(下記参照)。しかし、私は他の機能(z軸スライダなど)を使用できるように "ImageView"を使いたいと思っています。これどうやってするの?私は「ImageViewの」にコマンドを変更すると、私は次のエラーを取得するpg.ImageItemをpg.ImageViewに変換して画像とZ軸スライダを表示
はAttributeError:「ImageViewの」オブジェクトが「Z値」
は、誰もが私が間違っているつもりですどこ私にしてください教えてもらえます何の属性を持っていません。これに関する助けをありがとう。
from PyQt5 import uic, QtCore, QtGui, QtWidgets
import sys
import pyqtgraph as pg
import numpy as np
class ViewData(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(ViewData, self).__init__(parent)
uic.loadUi('test.ui',self)
win = pg.GraphicsLayout()
p = win.addViewBox()
imv = pg.ImageItem()
self.view.setCentralItem(win)
self.view.show()
imagedata = np.random.random((256,256))
imv.setImage(imagedata)
p.addItem(imv)
def main():
app = QtWidgets.QApplication(sys.argv) # A new instance of QApplication
vd = ViewData() # We set the form to be our MainWindow (design)
vd.show() # Show the form
app.exec_() # and execute the app
if __name__ == '__main__': # if we're running file directly and not importing it
main() # run the main function
大変ありがとうございます。それはまさに私が必要としたものだ –
申し訳ありませんが、受け入れについて知りませんでした –