('A customizable Tkinter-based text console widget, in which a user types in commands to be sent to the Python interpreter.',)
Project description
text_console
text_console is a customizable, Tkinter-based interactive shell widget that lets users type commands into a console pane and have them evaluated in your application’s Python environment. It supports arrows and command history. It’s designed for embedding in GUI apps, debugging, scripting, and educational tools as an API Playground.
It can also be used as a standalone Python command interpreter.
This program is similar to wxPython Shell, implemented using Tkinter.
Key Features
-
Live code execution
Send single- or multi-line Python code to the interpreter and see results immediately.
-
Integrated application context
Access and modify your app’s variables and functions via the console_locals namespace.
-
Advanced editing
- Keyboard shortcuts: all standard keyboard shortcut are allowed
- Multiline editing: Single line and multiline editing is allowed, also with copy/paste features. When pressing enter within an edited line, a popup appears to ask the requested action (execute the command, add a new line, abort). Shift-Enter is also allowed.
- Prompt Protection: The prompt area (
>>>or...) is protected. The cursor cannot move into or before the prompt, and editing actions (insertion, deletion) are blocked in the prompt area. - Smart Arrow Navigation: Left and right arrow keys skip over prompt tags and any protected regions, ensuring the cursor only lands in editable areas. Arrow navigation also respects line boundaries and prompt positions.
- Home/End Navigation: The
HomeandEndkeys move the cursor to the beginning or end of the current line, but never into the prompt area. - Undo/Redo Support: Full undo/redo support is enabled (
Ctrl+Z/Ctrl+Y), with fine-grained control for character-by-character undo. - Tab and Shift+Tab: Pressing
Tabinserts four spaces. PressingShift+Tabremoves up to four spaces. - Selection Awareness: Editing and navigation actions are aware of text selection. For example, custom arrow key logic is bypassed when a selection is active.
- Clear Console: The console can be cleared with a single command, automatically restoring the prompt and positioning the cursor for new input.
-
Command history
Navigate previous commands with ↑/↓ arrows; history is saved to a file you choose.
-
Cut/Copy/Paste/Clear
Right-click context menu (and customizable via context_menu_items) for text editing.
-
Customizable UI
The package provides flexibility to customize:
history_file: Change the location of the history fileconsole_locals: Add custom variables and functions to the console's namespacecontext_menu_items: Modify the right-click context menushow_about_message: Customize the about dialog contentshow_help_content: Customize the help window contentcreate_menu: Override to completely customize the menu bar
-
Subclass-friendly
Extend the TextConsole class and override any of the above to fit your needs.
Full information and usage details at the text_console GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file text_console-2.0.3.tar.gz.
File metadata
- Download URL: text_console-2.0.3.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33bdce29b5bae87f81c3b763c06b73001a1db99108e6178576bdcce230069ae5
|
|
| MD5 |
2b374a07e2b0216201179d05aeb76df4
|
|
| BLAKE2b-256 |
a81f91e7249ab7963ec5dfd42ff891474d860f3deed4079d7e08644f40591fea
|