Added an example for PyQt5 (#389)

* added pyqt5 example

* fixed example path on build

* improved pyqt example

* simplified example
This commit is contained in:
willbelr
2020-12-24 08:44:23 -05:00
committed by GitHub
parent 7514ebbe1a
commit 380e812373
11 changed files with 24 additions and 2 deletions
+1 -1
View File
@@ -308,7 +308,7 @@ export(TARGETS ${QTERMWIDGET_LIBRARY_NAME}
# example application
if(BUILD_EXAMPLE)
set(EXAMPLE_SRC example/main.cpp)
set(EXAMPLE_SRC examples/cpp/main.cpp)
add_executable(example ${EXAMPLE_SRC})
target_link_libraries(example ${QTERMWIDGET_LIBRARY_NAME})
endif()
-1
View File
@@ -1 +0,0 @@
here is sample program which uses QTermWidet for displaying a terminal
+1
View File
@@ -0,0 +1 @@
Here are two sample programs which use QTermWidget for displaying a terminal
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/python3
from PyQt5 import QtWidgets
from QTermWidget import QTermWidget
class Terminal(QTermWidget):
def __init__(self, process: str, args: list):
super().__init__(0)
self.finished.connect(self.close)
self.setTerminalSizeHint(False)
self.setColorScheme("DarkPastels")
self.setShellProgram(process)
self.setArgs(args)
self.startShellProgram()
self.show()
if __name__ == "__main__":
app = QtWidgets.QApplication([])
args = ["--clean", "--noplugin"]
term = Terminal("vim", args)
app.exec()