from
PyQt5.QtWidgets
import
*
import
sys
import
pyqtgraph as pg
class
Window(QMainWindow):
def
__init__(
self
):
super
().__init__()
self
.setWindowTitle(
"PyQtGraph"
)
self
.setGeometry(
100
,
100
,
600
,
500
)
self
.UiComponents()
self
.show()
def
UiComponents(
self
):
widget
=
QWidget()
btn
=
QPushButton(
'Push Button'
)
text
=
QLineEdit(
"Line Edit"
)
check
=
QCheckBox(
"Check Box"
)
plot
=
pg.plot()
y1
=
[
5
,
5
,
7
,
10
,
3
,
8
,
9
,
1
,
6
,
2
]
x
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
bargraph
=
pg.BarGraphItem(x
=
x, height
=
y1, width
=
0.6
, brush
=
'g'
)
plot.addItem(bargraph)
layout
=
QGridLayout()
widget.setLayout(layout)
layout.addWidget(btn,
0
,
0
)
layout.addWidget(text,
1
,
0
)
layout.addWidget(check,
3
,
0
)
layout.addWidget(plot,
0
,
1
,
3
,
1
)
self
.setCentralWidget(widget)
App
=
QApplication(sys.argv)
window
=
Window()
sys.exit(App.
exec
())