TkConsole is a Python library that provides a customizable terminal-like console widget using the Tkinter GUI framework.
TkConsole can be installed using pip:
pip install SIESTAstepper
# to make sure you have the latest version
pip install -U SIESTAstepper
# latest available code base
pip install -U git+https://github.com/eftalgezer/TkConsole.git
Building an interactive console interface with TkConsole
To use TkConsole in your Python application, you can follow these steps:
import tkinter as tk
from TkConsole import Console
root = tk.Tk()
console = Console(root)
console.pack(expand=True, fill="both")
console.print("Hello, world!")
user_input = console.input("Enter something: ")
console.print(f"You entered: {user_input}")
root.mainloop()
- Customizable font, background, and foreground colors
- Printing text to the console
- Taking user input
- Copy and paste functionality
TkConsole comes with a comprehensive set of unit tests to ensure its functionality. To run the tests, navigate to the tests directory and execute tests.py:
cd tests
python tests.py
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.