hi 

If you want i had written a short example using pyQt and pyqtgraph if it 
could help :




from PyQt5.QtWidgets import 
QApplication,QVBoxLayout,QHBoxLayout,QWidget,QPushButton,QGridLayout
from PyQt5.QtWidgets import 
QInputDialog,QSlider,QCheckBox,QLabel,QSizePolicy,QMenu,QMessageBox,QSpinBox
from PyQt5.QtWidgets import QShortcut
from pyqtgraph.Qt import QtCore,QtGui 
from PyQt5.QtCore import Qt
import pyqtgraph as pg 
import sys
import numpy  as np


class WIND(QWidget):
    def __init__(self): # 
        # done  when you start the class 
        super(WIND, self).__init__() # permet d'initialiser la class WIND 
avec init de la la class Qwidget dont elle depend
        self.setup()
        self.ActionButton()
    
    def setup(self):
        
        self.vbox1=QVBoxLayout() #layout Vertical box 
        self.hbox2=QHBoxLayout()
        
        self.Button1=QPushButton('Bouton 1',self)
        self.Button2=QPushButton('Bouton 2',self)
        
        self.hbox2.addWidget(self.Button1)
        self.hbox2.addWidget(self.Button2)
        
        self.vbox1.addLayout(self.hbox2)
        
        self.Button3=QPushButton('Bouton 3',self)
        self.vbox1.addWidget(self.Button3)
        
        self.grid_layout = QGridLayout() # display with a mesh
        self.checkBox1=QCheckBox('Check box',self)
        self.labelBox2=QLabel('LAbel :',self)
        self.box3=QSpinBox(self)
        self.grid_layout.addWidget(self.checkBox1, 0, 0)
        self.grid_layout.addWidget(self.labelBox2,1,0)
        self.grid_layout.addWidget(self.box3, 0, 1)
    
        self.vbox1.addLayout(self.grid_layout)
        
        hMainLayout=QHBoxLayout()
        hMainLayout.addLayout(self.vbox1)
        
        
        ### add a  2D pyqrgraph 
        
        
        self.winImage = pg.GraphicsLayoutWidget()
        
        self.winImage.setAspectLocked(True)
        self.winImage.setSizePolicy(QSizePolicy.Expanding, 
QSizePolicy.Expanding)
        
        
        self.vbox2=QVBoxLayout()
       
        self.vbox2.addWidget(self.winImage)
        self.vbox2.setContentsMargins(0,0,0,0)
        
        self.p1=self.winImage.addPlot()
        self.imh=pg.ImageItem()
        self.axeX=self.p1.getAxis('bottom')
        self.axeY=self.p1.getAxis('left')
        self.p1.addItem(self.imh)
        self.p1.setMouseEnabled(x=False,y=False)
        self.p1.setContentsMargins(0,0,0,0)
   
        self.p1.setAspectLocked(True,ratio=1)
        self.p1.showAxis('right',show=False)
        self.p1.showAxis('top',show=False)
        self.p1.showAxis('left',show=True)
        self.p1.showAxis('bottom',show=True)
        
        self.data=np.random.rand(350, 400)
        self.imh.setImage(self.data)
        
        hMainLayout.addLayout(self.vbox2)
        
        
        self.setLayout(hMainLayout)  # 
    
    def ActionButton(self): # definition de ce qui se passe quand tu clique
        self.box3.editingFinished.connect(self.Actionbox)
        self.Button1.clicked.connect(self.ActionButton1)
        self.checkBox1.stateChanged.connect(self.ActionCheckBox1)
        
    def Actionbox(self):
        print('box', self.box3.value())
    
    def ActionButton1(self):
        print('action button1')
        
    def ActionCheckBox1(self):
        print('action')
        
if __name__ == "__main__":
    
    appli = QApplication(sys.argv) 
    #appli.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) Si tu veux en 
noir 
    e = WIND()
    e.show()
    appli.exec_()      

Le lundi 1 juin 2020 18:55:58 UTC+2, Erik J a écrit :
>
> Hi David,
>
> I have done a lot of work embedding images, plots and charts into PyQt5 
> applications. Please describe a bit more what you are trying to accomplish 
> and I'll see if I can get you pointed in the right direction. I'm pretty 
> maxed out with work, so it may be a few days before I get back to you.
>
> Regards,
> Erik
>
> On Mon, Jun 1, 2020 at 3:16 AM David Francis <[email protected] 
> <javascript:>> wrote:
>
>> Hi, I am new to programming but have managed to design a GUI interface 
>> for my project. I would now like to have a graph on my GUI but when I add 
>> one it takes over the whole window... is there a way of imbedding a graph 
>> into a text box??
>>
>> -- 
>> 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/b13c737a-c6e5-4de4-970b-53614337c9a1%40googlegroups.com
>> .
>>
>
>
> -- 
>
> ************************************************
> Erik JohanssonProject Manager, Wavefront Correction System
> National Solar Observatory
> Daniel K Inouye Solar Telescope
> 3665 Discovery Drive, Boulder, CO 80303
> Tel: 303-735-7723
> ************************************************
>
>

-- 
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/a72ad4f3-dc86-467b-bec0-382607eee367%40googlegroups.com.

Reply via email to