Alternatively, you can leave it as a QWidget in designer & add the image &
HistorgramLUTItem in code, along the lines of:
Enter code here... layout = QtGui.QGridLayout()
widget.setLayout(layout)
layout.setSpacing(0)
widget.plotView = pg.GraphicsView()
layout.addWidget(widget.plotView, 0, 0, 1, 1)
widget.plotItem = pg.PlotItem()
widget.plotItem.setAspectLocked()
widget.plotItem.resize = widget.resize
for axis in ("left", "bottom", "top", "right"):
widget.plotItem.showAxis(axis, False)
widget.plotView.setCentralItem(widget.plotItem)
widget.histogramItem = pg.HistogramLUTItem(image=image_item)
widget.plotItem.addItem(widget.histogramItem)
On Thursday, July 23, 2020 at 12:37:51 PM UTC-4, Erik J wrote:
>
> Hello,
>
> I have done this a few times. To make it work, I use a QWidget for the
> histogram display which I then promote to a pyqtgraph HistogramLutWidget.
> Try changing your QGraphics widget to be a QWidget then promote it to a
> HistogramLUTWidget. I think if you do that the rest should work fine.
>
> Regards,
> Erik
>
> On Thu, Jul 23, 2020 at 8:58 AM pilkrow slash <[email protected]
> <javascript:>> wrote:
>
>> Hello, I have little experience about pyqtgraph and sometimes simple
>> things look difficult.
>> What I'm looking for is to display a histogramLUT widget into a gui
>> created using qt Designer.
>> I import the .ui file but I don't know how I can insert it into my code
>> and connect it with an imageItem.
>>
>> [image: scrnsht1.png]
>>
>> [image: scrnsht0.png]
>>
>>
>>
>> class MainWindow(QMainWindow, ProcessDicom):
>> …
>> …
>> uic.loadUi(‘CEtb26.ui’, self)
>> …
>> …
>> self.im1 = pg.ImageItem(img,levels=[0, 255])
>> self.histWindow = self.findChild(PlotWidget, ‘wu’)
>> self.histWindow.setImageItem(self.im1)
>>
>>
>> but the only thing I get is an empty plot!
>>
>>
>> Thank you for your time.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pyqtgraph" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pyqtgraph/7e99924b-7997-4853-b486-e58c08bbd841o%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/pyqtgraph/7e99924b-7997-4853-b486-e58c08bbd841o%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/b264516b-9dba-411b-8a06-9d09e4320136o%40googlegroups.com.