HTMLify

Auto Update Testing
Views: 147 | Author: abh
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()

Comments