Glad you got it working! Regards, Erik
On Thu, Jul 23, 2020, 4:35 PM pilkrow slash <[email protected]> wrote: > Hello, I finally managed to make it work with your help. > > [image: sdsds.png] > > > The solution was: > Into qt Designer: > 1. create a QWidget at the point where HistogramLUTWidget will appear > 2. right click and promote it > 3. set Promoted Class Name: HistogramLUTWidget > set Promoted Class Header: pyqtgraph.widgets.HistogramLUTWidget > 4.save it > 5. In my code I removed the first line of code and left the second one > #self.wu = self.findChild(HistogramLUTWidget, 'wu') #--> removed > self.wu = pg.HistogramLUTWidget(fillHistogram=False) > everything worked! > > Thank you for your time! > > > Τη Πέμπτη, 23 Ιουλίου 2020 - 11:51:13 μ.μ. UTC+3, ο χρήστης Erik J έγραψε: >> >> If you still get an import error, you might have to try this for the >> header name: pyqtgraph.widgets.HistogramLUTWidget >> >> That works directly importing from a python terminal session: >> >> >>> import pyqtgraph.widgets.HistogramLUTWidget >> >>> >> >> On Thu, Jul 23, 2020 at 2:26 PM Erik Johansson <[email protected]> wrote: >> >>> You have to use the exact name of the python module for the header, >>> without the .py extension. It is case sensitive. You can find the name of >>> the module in the python site packages dir for your distribution. For >>> example on my machine it is >>> here: >>> /home/erikj/.local/lib/python3.8/site-packages/pyqtgraph/widgets/HistogramLUTWidget.py >>> In this case the header name should be "HistogramLUTWidget". Try that and >>> see if it works. >>> >>> Regards, >>> Erik >>> >>> >>> >>> On Thu, Jul 23, 2020 at 2:04 PM pilkrow slash <[email protected]> >>> wrote: >>> >>>> Sorry if there was a display problem with the previous screenshot. >>>> I attach a new one with the recommended changes. >>>> I removed the .h extension >>>> >>>> [image: screensht4.png] >>>> >>>> >>>> and I use the same code >>>> self.wu = self.findChild(HistogramLUTWidget, 'wu') >>>> self.wu = pg.HistogramLUTWidget(fillHistogram=False) >>>> >>>> After I get the error: ModuleNotFoundError: No module named >>>> 'histogramlutwidget' >>>> >>>> Τη Πέμπτη, 23 Ιουλίου 2020 - 9:57:26 μ.μ. UTC+3, ο χρήστης Erik J >>>> έγραψε: >>>>> >>>>> So this is where there is a slight disconnect in the way that >>>>> QtCreator/Designer auto fills the name of the header file. You should use >>>>> the name of the actual python file without the ".py". In this case that >>>>> would be "HistogramLUTWidget". Do not use the ".h" suffix. I think >>>>> QtCreateor/Designer fills that in automatically for a C++ header file. >>>>> >>>>> Hope that helps. >>>>> Erik >>>>> >>>>> On Thu, Jul 23, 2020 at 12:35 PM pilkrow slash <[email protected]> >>>>> wrote: >>>>> >>>>>> Hello, so I first create a qwidget which I promote to >>>>>> HistogramLUTWidget, right? >>>>>> In the dialog window I choose the base class name as "QWidget" >>>>>> the Promoted class name to "HistogramLUTWidget" >>>>>> Do I use the pyqtgraph.h as Header File or I have to use another one? >>>>>> I attached a snapshot of qt designer. >>>>>> The qwidget is called wu. >>>>>> >>>>>> [image: Screenshot from 2020-07-23 21-29-31.png] >>>>>> >>>>>> >>>>>> Finally I have to insert the widget into my code: >>>>>> >>>>>> >>>>>> uic.loadUi(‘CEtb26.ui’, self) >>>>>> >>>>>> self.wu = self.findChild(HistogramLUTWidget, 'wu') >>>>>> self.wu = pg.HistogramLUTWidget(fillHistogram=False) >>>>>> >>>>>> >>>>>> >>>>>> Is it correct? >>>>>> >>>>>> Best regards >>>>>> >>>>>> Τη Πέμπτη, 23 Ιουλίου 2020 - 7:37:51 μ.μ. UTC+3, ο χρήστης Erik J >>>>>> έγραψε: >>>>>>> >>>>>>> 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]> >>>>>>> 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyqtgraph/4e6e3c27-bdf8-490f-bab2-522cad846661o%40googlegroups.com > <https://groups.google.com/d/msgid/pyqtgraph/4e6e3c27-bdf8-490f-bab2-522cad846661o%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/CAMZ%2Buam_g37h6CVqv5wpDOm06FssipoFQOxGgL8Q9bN6%3Dhg-Ng%40mail.gmail.com.
