MCPcopy
hub / github.com/Textualize/textual / run

Method run

src/textual/app.py:2308–2362  ·  view source on GitHub ↗

Run the app. Args: headless: Run in headless mode (no output). inline: Run the app inline (under the prompt). inline_no_clear: Don't clear the app output when exiting an inline app. mouse: Enable mouse support. size: Force terminal

(
        self,
        *,
        headless: bool = False,
        inline: bool = False,
        inline_no_clear: bool = False,
        mouse: bool = True,
        size: tuple[int, int] | None = None,
        auto_pilot: AutopilotCallbackType | None = None,
        loop: AbstractEventLoop | None = None,
    )

Source from the content-addressed store, hash-verified

2306 return app.return_value
2307
2308 def run(
2309 self,
2310 *,
2311 headless: bool = False,
2312 inline: bool = False,
2313 inline_no_clear: bool = False,
2314 mouse: bool = True,
2315 size: tuple[int, int] | None = None,
2316 auto_pilot: AutopilotCallbackType | None = None,
2317 loop: AbstractEventLoop | None = None,
2318 ) -> ReturnType | None:
2319 """Run the app.
2320
2321 Args:
2322 headless: Run in headless mode (no output).
2323 inline: Run the app inline (under the prompt).
2324 inline_no_clear: Don't clear the app output when exiting an inline app.
2325 mouse: Enable mouse support.
2326 size: Force terminal size to `(WIDTH, HEIGHT)`,
2327 or None to auto-detect.
2328 auto_pilot: An auto pilot coroutine.
2329 loop: Asyncio loop instance, or `None` to use default.
2330 Returns:
2331 App return value.
2332 """
2333
2334 async def run_app() -> ReturnType | None:
2335 """Run the app."""
2336 return await self.run_async(
2337 headless=headless,
2338 inline=inline,
2339 inline_no_clear=inline_no_clear,
2340 mouse=mouse,
2341 size=size,
2342 auto_pilot=auto_pilot,
2343 )
2344
2345 if loop is None:
2346 if _ASYNCIO_GET_EVENT_LOOP_IS_DEPRECATED:
2347 # N.B. This does work with Python<3.10, but global Locks, Events, etc
2348 # eagerly bind the event loop, and result in Future bound to wrong
2349 # loop errors.
2350 return asyncio.run(run_app())
2351 try:
2352 global_loop = asyncio.get_event_loop()
2353 except RuntimeError:
2354 # the global event loop may have been destroyed by someone running
2355 # asyncio.run(), or asyncio.set_event_loop(None), in which case
2356 # we need to use asyncio.run() also. (We run this outside the
2357 # context of an exception handler)
2358 pass
2359 else:
2360 return global_loop.run_until_complete(run_app())
2361 return asyncio.run(run_app())
2362 return loop.run_until_complete(run_app())
2363
2364 async def _on_css_change(self) -> None:
2365 """Callback for the file monitor, called when CSS files change."""

Callers 15

__main__.pyFile · 0.45
rlock.pyFile · 0.45
take_svg_screenshotFunction · 0.45
markup.pyFile · 0.45
blocking01.pyFile · 0.45
blocking02.pyFile · 0.45
nonblocking01.pyFile · 0.45
center07.pyFile · 0.45
layout01.pyFile · 0.45
layout02.pyFile · 0.45
center05.pyFile · 0.45
center08.pyFile · 0.45

Calls 1

run_appFunction · 0.85

Tested by

no test coverage detected