Skip to content
Discussion options

You must be logged in to vote

Thanks Will, yup that works better. Here's the full example with that tweak just for future reference:

from time import sleep

from textual import on, work
from textual.app import App, ComposeResult, events
from textual.widgets import Footer, Log


def long_blocking_process() -> None:
    print("Connecting")
    sleep(3)
    print("Searching")
    sleep(3)
    print("Creating")


class OutputLog(Log):
    @on(events.Print)
    def on_print(self, event: events.Print) -> None:
        self.write(event.text)


class WorkerWithCapturePrintApp(App):
    BINDINGS = [
        ("space", "run_long_blocking_process", "Run long blocking process"),
    ]

    def compose(self) -> ComposeResult:
        

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@Tim-Cao
Comment options

@TomJGooding
Comment options

@willmcgugan
Comment options

@TomJGooding
Comment options

Answer selected by Tim-Cao
@Tim-Cao
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants