| 1 | import time |
| 2 | |
| 3 | import pytermgui as ptg |
| 4 | |
| 5 | |
| 6 | def macro_time(fmt: str) -> str: |
| 7 | return time.strftime(fmt) |
| 8 | |
| 9 | |
| 10 | ptg.tim.define("!time", macro_time) |
| 11 | |
| 12 | with ptg.WindowManager() as manager: |
| 13 | manager.layout.add_slot("Body") |
| 14 | manager.add( |
| 15 | ptg.Window("[bold]The current time is:[/]\n\n[!time 75]%c", box="EMPTY") |
| 16 | ) |