Need a Terminal Like widget usable from Python
-
I am writing an application where part of one of the window is a 'terminal' - where each new line typed is sent to a custom class, and the 'output' is collected from this class (this class is effectively a wrapper around a REST API to a remote service. I am using PySide6.
I could do a simple display widget and a separate 'entry line widget' underneath it, but i would prefer to have a single seamless widget, to allow terminal like scrolling, copy/paste etc.
My initial thought was to use QPlainTextEdit but i am struggling on a number of things :
- restricting input just to the end of the text - in a terminal you can't simply type anywhere you want.
- capturing the new text that is typed when the return is pressed.
Does anyone have any examples in Python that uses QPlainTextEdit - or a 3rd party widget with Python biindings
-
I am writing an application where part of one of the window is a 'terminal' - where each new line typed is sent to a custom class, and the 'output' is collected from this class (this class is effectively a wrapper around a REST API to a remote service. I am using PySide6.
I could do a simple display widget and a separate 'entry line widget' underneath it, but i would prefer to have a single seamless widget, to allow terminal like scrolling, copy/paste etc.
My initial thought was to use QPlainTextEdit but i am struggling on a number of things :
- restricting input just to the end of the text - in a terminal you can't simply type anywhere you want.
- capturing the new text that is typed when the return is pressed.
Does anyone have any examples in Python that uses QPlainTextEdit - or a 3rd party widget with Python biindings
@TonySuffolk
Struggling to find this for Python. You might have a look at really simple https://gist.github.com/ssokolow/6f93e68d2af774aebf18667a7760cd23? Remove the bits which run a subprocess and replace with your own output. It might be useful just to show how it handles the input and scrolling in aQTextEdit
/QPlainTextEdit
?