-
Notifications
You must be signed in to change notification settings - Fork 0
/
toolbar.py
36 lines (28 loc) · 874 Bytes
/
toolbar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from PyQt5.QtWidgets import *
import sys
class Window(QWidget):
def __init__(self):
QWidget.__init__(self)
layout = QGridLayout()
self.setLayout(layout)
# Create pyqt toolbar
toolBar = QToolBar()
layout.addWidget(toolBar)
# Add buttons to toolbar
toolButton = QToolButton()
toolButton.setText("Apple")
toolButton.setCheckable(True)
toolButton.setAutoExclusive(True)
toolBar.addWidget(toolButton)
toolButton = QToolButton()
toolButton.setText("Orange")
toolButton.setCheckable(True)
toolButton.setAutoExclusive(True)
toolBar.addWidget(toolButton)
# Add textfield to window
tbox = QPlainTextEdit()
layout.addWidget(tbox)
app = QApplication(sys.argv)
screen = Window()
screen.show()
sys.exit(app.exec_())