Hi guys,
I have a working graphing program with start stop and exit buttons. I'd like to know if there is simple way to have both the graph and buttons in the same window. Right now I have two separate gui windows.
I stripped the code down to just the gui elements:
#Start the Gui window
app = QtGui.QApplication([])
#Setup the plot
p = pg.plot()
p.setWindowTitle('Its about Real-Time')
#Make depths go down
p.invertY(True)
p.resize(1024, 768)
#define our curve
curve = p.plot()
#Start and Stop Buttons
class Buttons(QtGui.QMainWindow):
def __init__(self):
super(Buttons, self).__init__()
self.initUI()
def initUI(self):
btn1 = QtGui.QPushButton("Start", self)
btn1.move(30, 50)
btn2 = QtGui.QPushButton("Stop", self)
btn2.move(150, 50)
btn3 = QtGui.QPushButton("Exit", self)
btn3.move(270, 50)
self.statusBar()
self.setGeometry(300, 300, 400, 150)
self.setWindowTitle('Event sender')
self.show()
#Run Button program
bt = Buttons()
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()