HTMLify
Auto Update Testing
Views: 1035 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from textual.app import App from textual.containers import ScrollableContainer from textual.widget import Widget from threading import Thread from time import sleep class CustemWidget(Widget): def render(self): return "Something" class AutoUpdateApp(App): def compose(self): yield ScrollableContainer(CustemWidget()) def auto_updater(app): while True: sleep(1) try: app.query_one("ScrollableContainer").mount(CustemWidget()) except Exception as e: app.notify(str(e)) app = AutoUpdateApp() Thread(target=auto_updater, args=(app,)).start() app.run() |