Welcome to PyQTermWidget’s documentation!¶
Unlike the older pyqonsole this console widget works with PyQt4 and let’s you embed a shell into your application.
The vt100 terminal emulation code is based on AjaxTerm and WebShell. All code is distributed under the General Public License 2.
Contents:
How to use PyQTermWidget¶
Here is a minimal example:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt4.QtGui import QApplication
from pyqterm import TerminalWidget
if __name__ == "__main__":
app = QApplication(sys.argv)
win = TerminalWidget()
win.resize(800, 600)
win.show()
app.exec_()
Look into demo.py for a more complete example with a tabbed terminal application.

The constructor has the following signature:
- def __init__(self, parent=None, command=”/bin/bash”, font_name=”Monospace”, font_size=18)
The widget has the following methods:
- execute(command=”/bin/bash”)
- send(string)
- stop()
- pid() -> process id (int)
- zoom_in()
- zoom_out()
- text_selection() -> string
- update_screen()
- is_alive() -> bool
- row_count() -> int
- column_count() -> int
- text() -> string
TerminalWidget inherits directly from QWidget, so it has show, hide, setFont, etc.
The widget emits the following signals:
- session_closed()
- return_pressed()
TODO¶
- add keyboard shortcuts to switch focus to other widgets
- get screen output as string
- history / scrolling
- mouse selection: tripple click (select line)
- keyboard shortcuts to insert from clipboard/xselection
- better rendering speed
- let user deactivate blinking cursor
How to get it¶
The latest snapshot is available at:
https://bitbucket.org/henning/pyqtermwidget/get/tip.tar.bz2
To clone the Mercurial repository do:
hg clone https://bitbucket.org/henning/pyqtermwidget
Or just got to the BitBucket overview page: https://bitbucket.org/henning/pyqtermwidget

The Python Packaging Index (PyPI) also contains releases: http://pypi.python.org/pypi/pyqterm
The generated HTML-documentation is hosted at http://pyqtermwidget.rtfd.org/ (PDF: http://media.readthedocs.org/pdf/pyqtermwidget/latest/pyqtermwidget.pdf).