bczsalba / pytermgui

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
https://ptg.bczsalba.com
MIT License
2.21k stars 54 forks source link

[BUG] Documentation is invalid #40

Closed skorokithakis closed 2 years ago

skorokithakis commented 2 years ago

The documentation snipped here is invalid Python code:

import pytermgui as ptg

with ptg.WindowManager() as manager:
    manager.add(
        ptg.Window()
        + "[wm-title]My first window!",
        + "",
        + ["Exit", lambda *_: manager.exit()],
    )

    manager.run()

Also, the examples on the front page are nice for illustrating the various ways of declaring an interface, but when trying to run them I was taken aback by the fact that a window wouldn't launch. I eventually found the manager.add() function, but it would be nice if that were in the README somewhere so people could quickly try the framework out.

bczsalba commented 2 years ago

Where is that bit of code from? No idea why it's like this and why no one has caught it yet.

Good tip about the manager.add function, will look into putting it somewhere more obvious.

skorokithakis commented 2 years ago

Oh, it's from here: https://ptg.bczsalba.com/pytermgui.html (the "Adding windows during definition" one), sorry!

bczsalba commented 2 years ago

Thank you for the reference! I updated the docs to fix the issue, but the update will only be pushed with the next release, as some of the updates since 3.1.0 contain some changes that would be documented before they are pushed.