Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
✨ Code for testing Textualize/textual#3615
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Oct 31, 2023
1 parent de0a5c7 commit fac9d1e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions work_command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""https://github.com/Textualize/textual/issues/3615"""

import asyncio
from textual import work
from textual.app import App, ComposeResult
from textual.widgets import RichLog

class Test(App):
CSS = '''
RichLog {
height: 100%;
}
'''
def compose(self) -> ComposeResult:
yield RichLog(id = 'log')

def on_mount(self) -> None:
self.my_worker()

@work(exclusive=True, group="foo")
async def my_worker(self):
counter = 1

log = self.query_one('#log', RichLog)
while True:
log.write(f'test {counter}')
counter += 1
await asyncio.sleep(1)

if __name__ == "__main__":
Test().run()

### work_command.py ends here

0 comments on commit fac9d1e

Please sign in to comment.