https://github.com/bczsalba/pytermgui Skip to content Sign up * Why GitHub? + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} bczsalba / pytermgui Public * * Notifications * Fork 14 * Star 527 A simple yet powerful TUI framework for your Python (3.7+) applications. ptg.bczsalba.com/pytermgui.html MIT License 527 stars 14 forks Star Notifications * Code * Issues 7 * Pull requests 0 * Discussions * Actions * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Security * Insights This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 17 tags Code Latest commit @bczsalba bczsalba Improve pretty printing in various ways: ... d0ae9cc Mar 1, 2022 Improve pretty printing in various ways: - Auto-condense containers with `len` less <= 1 - Add support for the full `print` signature by pprint-ing all *args, and passing **kwargs to `print` - Add syntax highlighting to integers d0ae9cc Git stats * 818 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github Add ko-fi sponsorship option Mar 1, 2022 assets Update badges Jan 25, 2022 docs Auto-update documentation Feb 27, 2022 examples Add and apply formatter (#31) Jan 29, 2022 pytermgui Improve pretty printing in various ways: Mar 1, 2022 tests Update ongoing.py Feb 20, 2022 utils Update badges Jan 25, 2022 .gitignore Add gitignore and do some code splitting (#28) Jan 29, 2022 .prettierignore Add and apply formatter (#31) Jan 29, 2022 .pylintrc Add and apply formatter (#31) Jan 29, 2022 CHANGELOG.md Version 3.1.0 Feb 27, 2022 CONTRIBUTING.md Add some extra information to CONTRIBUTING.md Jan 29, 2022 LICENSE Add license file Jan 3, 2022 README.md Add Projects to check out section to README. Feb 22, 2022 notes.md Add and apply formatter (#31) Jan 29, 2022 project-config Update project-config to use google docformat Jan 23, 2022 setup.py Fix widgets/interactive not being packaged Feb 11, 2022 View code [ ] Batteries included or bare-metal. It's your choice. Zero dependencies Adapting to your needs A powerful CLI Fully documented Projects using pytermgui Some showcase images A hello world program The markup playground app A simple window manager demo in 13 lines of code, lifted from the docs Projects to check out README.md title A simple yet powerful TUI framework for your Python (3.7+) applications pip3 install pytermgui PyPi project Code quality [6874747073] [6874747073] Batteries included or bare-metal. It's your choice. PyTermGUI has both higher and lower level interfaces. If you're only here for the terminal APIs, ansi_interface will be your friend. Zero dependencies Everything here is home made, just like your grandmas cookies. There is only one optional dependency, PyYaml, which you won't have to install unless you plan on using YAML features. Adapting to your needs Here are just a couple of ways to define the same widget structure: Using the basic class structure # -- demo.py -- import pytermgui as ptg demo = ptg.Window( ptg.Label("[210 bold]Hello world!"), ptg.Label(), ptg.InputField(prompt="Who are you?"), ptg.Label(), ptg.Button("Submit!") ) Using data-pattern conversion # -- demo.py -- import pytermgui as ptg demo = ( ptg.Window() + "[210 bold]Hello world!" + "" + ptg.InputField(prompt="Who are you?") + "" + ["Submit!"] ) Using YAML # -- demo.yaml -- widgets: demo: type: Window widgets: - Label: value: "[210 bold]Hello world!" - Label: {} - InputField: prompt: Who are you? - Label: {} - Button: label: Submit! None of these is better than any other, it is all up to individual taste. We don't force you to do what we want, rather encourage you to morph the library around your needs. By the way, this is what the created Window looks like. Nifty, huh? [versatilit] A powerful CLI The cli simultaneously serves as a set of powerful tooling for TUI related work, as well as a nice usage example of the higher level part of the library. You can run ptg --getch to get information about a keypress, ptg --size to get the current terminal dimensions and ptg --file to interpret & run a YAML markup file inside of a window manager. For more info, check out ptg -h. Fully documented The documentation details every public name in the library, making its usage as easy as possible. For more complete projects, check out examples, or some of the projects using PTG. Projects using pytermgui We take pride in seeing others use the library. If you have a project you'd like us to add here, create a PR! Project Project description Demo name image sipedon An interactive aquarium for your terminal. [sipedon] tracers Easily debug and trace attribute changes in your [tracers] Python classes Some showcase images Click on each image to see their source code! A hello world program hello world The markup playground app Note: Use ptg --markapp to try markapp A simple window manager demo in 13 lines of code, lifted from the docs window manager Projects to check out The TUI game has been heating up as of recent. Here are some other interesting projects in the sphere: * Winman - A window-manager add-on to the golang library tview. This project was a big inspiration for that specific aspect of PyTermGUI. * Rich & Textual - Another Python-based set of TUI libraries. Some of the Rich markup syntax & code was used as inspiration for our own. * pyTermTk - Name and functionality sibling of this project. Great TUI library if you are after tkinter/qt5 mimicking API. * Jexer - One of the most insane-looking TUI libraries out there. Supports practically everything the terminal can do. I became aware of this project relatively recently, but it's been of great inspiration. * notcurses - Another ridiculously powerful TUI library. Well worth installing and checking out the examples provided. About A simple yet powerful TUI framework for your Python (3.7+) applications. ptg.bczsalba.com/pytermgui.html Topics python gui terminal cross-platform typing tui python3 ansi-escape-codes ansi-escape-sequences pytermgui Resources Readme License MIT License Stars 527 stars Watchers 9 watching Forks 14 forks Releases 16 v3.1.0: Prettify everything! Latest Feb 27, 2022 + 15 releases Sponsor this project * ko_fi ko-fi.com/bczsalba Used by 10 * @UltraStudioLTD * @bczsalba * @ProfMonkey07 * @bczsalba * @bczsalba * @r00l * @mo-han + 2 Contributors 6 * @bczsalba * @UltraStudioLTD * @github-actions[bot] * @rbanffy * @developomp * @jakkso Languages * Python 99.6% * Shell 0.4% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.