-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
30 lines (24 loc) · 836 Bytes
/
example.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
import sys
from qtpy import QtGui, QtWidgets
from qtpyTerminal import qtpyTerminal
# Create the Qt application and console.
app = QtWidgets.QApplication([])
mainwin = QtWidgets.QMainWindow()
mainwin.setWindowTitle("qtpyTerminal example")
container = QtWidgets.QWidget(mainwin)
container.setLayout(QtWidgets.QVBoxLayout())
mainwin.setCentralWidget(container)
console = qtpyTerminal(mainwin)
def exit():
console.stop()
app.quit()
start_button = QtWidgets.QPushButton("Start shell", container)
start_button.clicked.connect(console.start)
container.layout().addWidget(start_button)
container.layout().addWidget(console)
quit_button = QtWidgets.QPushButton("Quit", container)
quit_button.clicked.connect(exit)
container.layout().addWidget(quit_button)
# Show widget and launch Qt's event loop.
mainwin.show()
sys.exit(app.exec_())