textual API reference
400 public APIs from textual (Textualize/textual) — 97 classes, 83 functions, 220 methods. Signatures extracted by static analysis of the actual source.
Repository: Textualize/textual
| Kind | Count |
|---|---|
| Classes | 97 |
| Functions | 83 |
| Methods | 220 |
API list
method
src.textual.Logger.app() -> _App | NoneThe associated application, or `None` if there isn't one.
method
src.textual.Logger.debug() -> LoggerLogs debug messages.
method
src.textual.Logger.error() -> LoggerLogs errors.
method
src.textual.Logger.event() -> LoggerLogs events.
method
src.textual.Logger.info() -> LoggerLogs information.
method
src.textual.Logger.logging() -> LoggerLogs from stdlib logging module.
method
src.textual.Logger.system() -> LoggerLogs system information.
method
src.textual.Logger.verbose() -> LoggerA verbose logger.
method
src.textual.Logger.verbosity(verbose:bool) -> LoggerGet a new logger with selective verbosity.
method
src.textual.Logger.warning() -> LoggerLogs warnings.
method
src.textual.Logger.worker() -> LoggerLogs worker information.
class
src.textual.LoggerErrorRaised when the logger failed.
method
src.textual._animator.Animation.stop(complete:bool=True) -> NoneStop the animation.
class
src.textual._animator.AnimationErrorAn issue prevented animation from starting.
class
src.textual._ansi_sequences.IgnoredSequenceClass used to mark that a sequence should be ignored.
func
src.textual._ansi_theme.rgb(red:int, green:int, blue:int) -> tuple[int, int, int]Define an RGB color.
class
src.textual._binary_encode.DecodeErrorA problem decoding data.
func
src.textual._binary_encode.decode() -> objectRecursively decode data.
func
src.textual._binary_encode.decode_bytes(size_bytes:bytes) -> bytesDecode a bytes string from the encoded data.
func
src.textual._binary_encode.decode_dict() -> dict[object, object]Decode a dict.
func
src.textual._binary_encode.decode_int() -> intDecode an int from the encoded data.
func
src.textual._binary_encode.decode_list() -> list[object]Decode a list.
func
src.textual._binary_encode.decode_string() -> strDecode a (utf-8 encoded) string from the encoded data.
func
src.textual._binary_encode.decode_tuple() -> tuple[object, ...]Decode a tuple.
func
src.textual._binary_encode.dump(data:object) -> bytesEncodes a data structure into bytes.
func
src.textual._binary_encode.encode(datum:object) -> bytesRecursively encode data.
func
src.textual._binary_encode.encode_bool(datum:bool) -> bytesEncode a boolean value.
func
src.textual._binary_encode.encode_bytes(datum:bytes) -> bytesEncode a bytes value.
func
src.textual._binary_encode.encode_dict(datum:dict) -> bytesEncode a dictionary value.
func
src.textual._binary_encode.encode_int(datum:int) -> bytesEncode an integer value.
func
src.textual._binary_encode.encode_list(datum:list) -> bytesEncode a list value.
func
src.textual._binary_encode.encode_none(_datum:None) -> bytesEncodes a None value.
func
src.textual._binary_encode.encode_string(datum:str) -> bytesEncode a string value.
func
src.textual._binary_encode.encode_tuple(datum:tuple) -> bytesEncode a tuple value.
func
src.textual._binary_encode.get_byte() -> bytesGet an encoded byte and advance position.
func
src.textual._binary_encode.get_bytes(size:int) -> bytesGet a number of bytes of encode data.
func
src.textual._binary_encode.load(encoded:bytes) -> objectLoad an encoded data structure from bytes.
func
src.textual._border.get_box(name:EdgeType, inner_style:Style, outer_style:Style, style:Style) -> BoxSegmentsGet segments used to render a box.
func
src.textual._box_drawing.combine_quads(box1:Quad, box2:Quad) -> QuadCombine two box drawing quads.
func
src.textual._callback.count_parameters(func:Callable) -> intCount the number of parameters in a callable
func
src.textual._callback.invoke(callback:Callable[..., Any], *params:object) -> AnyInvoke a callback with an arbitrary number of parameters.
func
src.textual._callback.log_slow() -> NoneLog a message regarding a slow callback.
class
src.textual._compositor.ChopsUpdateA renderable that applies updated spans to the screen.
class
src.textual._compositor.InlineUpdateA renderable to write an inline update.
class
src.textual._compositor.ReflowResultThe result of a reflow operation.
func
src.textual._dispatch_key.dispatch_key(node:DOMNode, event:events.Key) -> boolDispatch a key event to method.
func
src.textual._doc.rich(source, language, css_class, options, md, attrs, **kwargs) -> strA superfences formatter to insert an SVG screenshot.
class
src.textual._duration.DurationErrorException indicating a general issue with a CSS duration.
class
src.textual._event_broker.HandlerArgumentsInformation for event handler.
class
src.textual._event_broker.NoHandlerRaised when handler isn't found in the meta.
func
src.textual._event_broker.extract_handler_actions(event_name:str, meta:dict[str, Any]) -> HandlerArgumentsExtract action from meta dict.
class
src.textual._extrema.ExtremaSpecifies minimum and maximum dimensions.
method
src.textual._extrema.Extrema.apply_dimensions(width:int, height:int) -> SizeApply extrema to integer dimensions.
method
src.textual._extrema.Extrema.apply_height(height:Fraction) -> FractionApply height extrema.
method
src.textual._extrema.Extrema.apply_width(width:Fraction) -> FractionApply width extrema.
func
src.textual._import_app.import_app(import_name:str) -> AppImport an app from a path or import name.
func
src.textual._import_app.shebang_python(candidate:Path) -> boolDoes the given file look like it's run with Python?
class
src.textual._layout_resolve.EdgeProtocolAny object that defines an edge (such as Layout).
func
src.textual._loop.loop_first(values:Iterable[T]) -> Iterable[tuple[bool, T]]Iterate and generate a tuple with a flag for first value.
func
src.textual._loop.loop_last(values:Iterable[T]) -> Iterable[tuple[bool, T]]Iterate and generate a tuple with a flag for last value.
class
src.textual._node_list.NodeListA container for widgets that forms one level of hierarchy.
method
src.textual._node_list.NodeList.displayed() -> Sequence[Widget]Just the nodes where `display==True`.
method
src.textual._node_list.NodeList.index(widget:Any, start:int=0, stop:int=sys.maxsize) -> intReturn the index of the given widget.
method
src.textual._node_list.NodeList.updated() -> NoneMark the nodes as having been updated.
class
src.textual._node_list.ReadOnlyErrorRaise if you try to mutate the list.
class
src.textual._on.OnDecoratorErrorErrors related to the `on` decorator.
class
src.textual._on.OnNoWidgetA selector was applied to an attribute that isn't a widget.
class
src.textual._parser.ParseEOFEnd of Stream.
class
src.textual._parser.ParseErrorBase class for parse related errors.
class
src.textual._parser.ParseTimeoutRead has timed out.
class
src.textual._parser.ParserBase class for a simple parser.
method
src.textual._parser.Parser.feed(data:str) -> Iterable[T]Feed data to be parsed.
method
src.textual._parser.Parser.is_eof() -> boolIs the parser at the end of the file (i.e.
method
src.textual._parser.Parser.parse(token_callback:TokenCallback) -> Generator[Read1 | Peek1, str, None]Implement to parse a stream of text.
method
src.textual._parser.Parser.tick() -> Iterable[T]Call at regular intervals to check for timeouts.
class
src.textual._parser.Read1Reads a single character.
func
src.textual._partition.partition(predicate:Callable[[T], object], iterable:Iterable[T]) -> tuple[list[T], list[T]]Partition a sequence into two list from a given predicate.
class
src.textual._path.CSSPathErrorRaised when supplied CSS path(s) are invalid.
func
src.textual._profile.timer(subject:str='time', threshold:float=0) -> Generator[None, None, None]print the elapsed time.
func
src.textual._resolve.resolve(dimensions:Sequence[Scalar], total:int, gutter:int, size:Size, viewport:Size, *expand:bool=False, *shrink:bool=False, *minimums:list[int] | None=None) -> list[tuple[int, int]]Resolve a list of dimensions.
func
src.textual._resolve.resolve_fraction_unit(widget_styles:Iterable[RenderStyles], size:Size, viewport_size:Size, remaining_space:Fraction, resolve_dimension:Literal['width', 'height']='width') -> FractionCalculate the fraction.
func
src.textual._resolve.resolve_scalar(scalar:Scalar | None, fraction_unit:Fraction=Fraction(1)) -> Fraction | NoneResolve a scalar if it is not None.
func
src.textual._segment_tools.align_lines(lines:list[list[Segment]], style:Style, size:Size, horizontal:AlignHorizontal, vertical:AlignVertical) -> Iterable[list[Segment]]Align lines.
func
src.textual._segment_tools.blank_lines(count:int) -> list[list[Segment]]Create blank lines.
func
src.textual._segment_tools.line_crop(segments:list[Segment], start:int, end:int, total:int) -> list[Segment]Crops a list of segments between two cell offsets.
func
src.textual._segment_tools.make_blank(width, style:Style) -> SegmentMake a blank segment.
class
src.textual._slug.TrackedSlugsProvides a class for generating tracked slugs.
method
src.textual._slug.TrackedSlugs.slug(text:str) -> strCreate a Markdown-friendly unique slug from the given text.
func
src.textual._slug.slug(text:str) -> strCreate a Markdown-friendly slug from the given text.
func
src.textual._slug.slug_for_tcss_id(text:str) -> strProduce a slug usable as a TCSS id from the given text.
func
src.textual._styles_cache.StylesCache.line_post(segments:Iterable[Segment]) -> Iterable[Segment]Apply effects to segments inside the border.
func
src.textual._styles_cache.StylesCache.post(segments:Iterable[Segment]) -> Iterable[Segment]Post process segments to apply opacity and tint.
class
src.textual._text_area_theme.TextAreaThemeA theme for the `TextArea` widget.
method
src.textual._text_area_theme.TextAreaTheme.builtin_themes() -> list[TextAreaTheme]Get a list of all builtin TextAreaThemes.
method
src.textual._text_area_theme.TextAreaTheme.get_builtin_theme(theme_name:str) -> TextAreaTheme | NoneGet a `TextAreaTheme` by name.
func
src.textual._time.sleep(secs:float) -> NoneSleep for a given number of seconds.
class
src.textual._two_way_dict.TwoWayDictA two-way mapping offering O(1) access in both directions.
method
src.textual._two_way_dict.TwoWayDict.contains_value(value:Value) -> boolCheck if `value` is a value within this TwoWayDict.
method
src.textual._two_way_dict.TwoWayDict.get(key:Key) -> Value | NoneGiven a key, efficiently lookup and return the associated value.
method
src.textual._two_way_dict.TwoWayDict.get_key(value:Value) -> Key | NoneGiven a value, efficiently lookup and return the associated key.
func
src.textual._wait.wait_for_idle(min_sleep:float=SLEEP_GRANULARITY, max_sleep:float=1) -> NoneWait until the process isn't working very hard.
class
src.textual._widget_navigation.DisableableNon-widgets that have an enabled/disabled status.
func
src.textual._win_sleep.cancel()Cancels the timer by setting the cancel event.
func
src.textual._win_sleep.time_sleep_coro(secs:float)Coroutine wrapper around `time.sleep`.
class
src.textual._work_decorator.WorkerDeclarationErrorAn error in the declaration of a worker method.
func
src.textual._work_decorator.decorated(*args:DecoratorParamSpec.args, **kwargs:DecoratorParamSpec.kwargs) -> Worker[ReturnType]The replaced callable.
func
src.textual._work_decorator.decorator(method:Callable[DecoratorParamSpec, ReturnType] | Callable[DecoratorParamSpec, Coroutine[None, None, ReturnType]]) -> Callable[DecoratorParamSpec, Worker[ReturnType]]The decorator.
func
src.textual._xterm_parser.XTermParser.on_key_token(event:events.Key) -> NoneToken callback wrapper for handling keys.
func
src.textual._xterm_parser.XTermParser.on_token(token:Message) -> NoneHook to log events.
func
src.textual._xterm_parser.XTermParser.send_sequence(process_alt:bool=True) -> NoneSend escape key and reissue sequence.
func
src.textual.actions.parse(action:str) -> ActionParseResultParses an action string.
class
src.textual.app.ActionErrorBase class for exceptions relating to actions.
class
src.textual.app.ActiveModeErrorRaised when attempting to remove the currently active mode.
class
src.textual.app.AppThe base class for Textual Applications.
method
src.textual.app.App.action_bell() -> NoneAn [action](/guide/actions) to play the terminal 'bell'.
method
src.textual.app.App.action_change_theme() -> NoneAn [action](/guide/actions) to change the current theme.
method
src.textual.app.App.action_command_palette() -> NoneShow the Textual command palette.
method
src.textual.app.App.action_focus(widget_id:str) -> NoneAn [action](/guide/actions) to focus the given widget.
method
src.textual.app.App.action_focus_next() -> NoneAn [action](/guide/actions) to focus the next widget.
method
src.textual.app.App.action_help_quit() -> NoneBound to ctrl+C to alert the user that it no longer quits.
method
src.textual.app.App.action_hide_help_panel() -> NoneHide the keys panel (if present).
method
src.textual.app.App.action_notify(message:str, title:str='', severity:str='information') -> NoneShow a notification.
method
src.textual.app.App.action_show_help_panel() -> NoneShow the keys panel.
method
src.textual.app.App.action_simulate_key(key:str) -> NoneAn [action](/guide/actions) to simulate a key press.
method
src.textual.app.App.action_suspend_process() -> NoneSuspend the process into the background.
method
src.textual.app.App.action_switch_mode(mode:str) -> NoneAn [action](/guide/actions) that switches to the given mode.
method
src.textual.app.App.action_switch_screen(screen:str) -> NoneAn [action](/guide/actions) to switch screens.
method
src.textual.app.App.active_bindings() -> dict[str, ActiveBinding]Get currently active bindings.
method
src.textual.app.App.add_mode(mode:str, base_screen:str | Callable[[], Screen]) -> NoneAdds a mode and its corresponding base screen to the app.
method
src.textual.app.App.animator() -> AnimatorThe animator object.
method
src.textual.app.App.ansi_theme() -> TerminalThemeThe ANSI TerminalTheme currently being used.
func
src.textual.app.App.app_prelude() -> boolWork required before running the app.
func
src.textual.app.App.app_ready() -> NoneCalled by the message loop when the app is ready.
method
src.textual.app.App.bell() -> NonePlay the console 'bell'.
method
src.textual.app.App.bind(keys:str, action:str, *description:str='', *show:bool=True, *key_display:str | None=None) -> NoneBind a key to an action.
method
src.textual.app.App.capture_mouse(widget:Widget | None) -> NoneSend all mouse events to the given widget or disable mouse capture.
func
src.textual.app.App.check_mouse() -> NoneCheck if the mouse over widget has changed.
method
src.textual.app.App.children() -> Sequence['Widget']A view onto the app's immediate children.
method
src.textual.app.App.clear_notifications() -> NoneClear all the current notifications.
method
src.textual.app.App.clear_selection() -> NoneClear text selection on the active screen.
method
src.textual.app.App.clipboard() -> strThe value of the local clipboard.
method
src.textual.app.App.compose() -> ComposeResultYield child widgets for a container.
method
src.textual.app.App.console_options() -> ConsoleOptionsGet options for the Rich console.
method
src.textual.app.App.copy_to_clipboard(text:str) -> NoneCopy text to the clipboard.
method
src.textual.app.App.current_mode() -> strThe name of the currently active mode.
method
src.textual.app.App.debug() -> boolIs debug mode enabled?
method
src.textual.app.App.default_screen() -> ScreenThe default screen instance.
method
src.textual.app.App.delay_update(delay:float=0.05) -> NoneDelay updates for a short period of time.
method
src.textual.app.App.deliver_screenshot(filename:str | None=None, path:str | None=None, time_format:str | None=None) -> str | NoneDeliver a screenshot of the app.
func
src.textual.app.App.do_pop() -> NoneTask to pop the screen.
func
src.textual.app.App.do_switch() -> NoneTask to perform switch.
func
src.textual.app.App.end_batch() -> NoneRe-enable updates, and refresh screen.
method
src.textual.app.App.end_capture_print(target:MessageTarget) -> NoneEnd capturing of prints.
method
src.textual.app.App.escape_to_minimize() -> boolUse the escape key to minimize?
method
src.textual.app.App.exit(result:ReturnType | None=None, return_code:int=0, message:RenderableType | None=None) -> NoneExit the app, and return the supplied result.
method
src.textual.app.App.export_screenshot(*title:str | None=None, *simplify:bool=False) -> strExport an SVG screenshot of the current screen.
method
src.textual.app.App.format_title(title:str, sub_title:str) -> ContentFormat the title for display.
method
src.textual.app.App.get_child_by_type(expect_type:type[ExpectType]) -> ExpectTypeGet a child of a give type.
method
src.textual.app.App.get_css_variables() -> dict[str, str]Get a mapping of variables used to pre-populate CSS.
method
src.textual.app.App.get_default_screen() -> ScreenGet the default screen.
method
src.textual.app.App.get_driver_class() -> Type[Driver]Get a driver class for this platform.
method
src.textual.app.App.get_key_display(binding:Binding) -> strFormat a bound key for display in footer / key panel etc.
method
src.textual.app.App.get_line_filters() -> Sequence[LineFilter]Get currently enabled line filters.
method
src.textual.app.App.get_loading_widget() -> WidgetGet a widget to be used as a loading indicator.
method
src.textual.app.App.get_system_commands(screen:Screen) -> Iterable[SystemCommand]A generator of system commands used in the command palette.
method
src.textual.app.App.get_theme(theme_name:str) -> Theme | NoneGet a theme by name.
method
src.textual.app.App.get_widget_at(x:int, y:int) -> tuple[Widget, Region]Get the widget under the given coordinates.
method
src.textual.app.App.handle_bindings_clash(clashed_bindings:set[Binding], node:DOMNode) -> NoneHandle a clash between bindings.
method
src.textual.app.App.install_screen(screen:Screen, name:str) -> NoneInstall a screen.
method
src.textual.app.App.is_attached() -> boolIs this node linked to the app through the DOM?
method
src.textual.app.App.is_dom_root() -> boolIs this a root node (i.e.
method
src.textual.app.App.is_headless() -> boolIs the app running in 'headless' mode?
method
src.textual.app.App.is_inline() -> boolIs the app running in 'inline' mode?
method
src.textual.app.App.is_mounted(widget:Widget) -> boolCheck if a widget is mounted.
method
src.textual.app.App.is_screen_installed(screen:Screen | str) -> boolCheck if a given screen has been installed.
method
src.textual.app.App.is_web() -> boolIs the app running in 'web' mode via a browser?
method
src.textual.app.App.log() -> LoggerThe textual logger.
method
src.textual.app.App.mount(*before:int | str | Widget | None=None, *after:int | str | Widget | None=None, *widgets:Widget) -> AwaitMountMount the given widgets relative to the app's screen.
method
src.textual.app.App.mount_all(widgets:Iterable[Widget], *before:int | str | Widget | None=None, *after:int | str | Widget | None=None) -> AwaitMountMount widgets from an iterable.
method
src.textual.app.App.native_ansi_color() -> boolUse native ANSI colors?
method
src.textual.app.App.notify(message:str, *title:str='', *severity:SeverityLevel='information', *timeout:float | None=None, *markup:bool=True) -> NoneCreate a notification.
func
src.textual.app.App.on_app_ready() -> NoneCalled when app is ready to process events.
method
src.textual.app.App.open_url(url:str, *new_tab:bool=True) -> NoneOpen a URL in the default web browser.
method
src.textual.app.App.panic(*renderables:RenderableType) -> NoneExits the app and display error message(s).
func
src.textual.app.App.pop_screens() -> NonePop any screens in `screens_to_pop`.
method
src.textual.app.App.post_display_hook() -> NoneCalled immediately after a display is done.
func
src.textual.app.App.post_mount() -> NoneCalled after removing children.
func
src.textual.app.App.press_keys(pilot:Pilot[ReturnType]) -> NoneAuto press keys.
method
src.textual.app.App.recompose() -> NoneRecompose the widget.
method
src.textual.app.App.refresh(*repaint:bool=True, *layout:bool=False, *recompose:bool=False) -> SelfRefresh the entire screen.
method
src.textual.app.App.refresh_css(animate:bool=True) -> NoneRefresh CSS.
method
src.textual.app.App.register_theme(theme:Theme) -> NoneRegister a theme with the app.
method
src.textual.app.App.remove_mode(mode:str) -> AwaitCompleteRemoves a mode from the app.
func
src.textual.app.App.remove_screens() -> NoneRemove screens.
func
src.textual.app.App.render(renderable:RenderableType) -> list[Segment]Render a panic renderables.
method
src.textual.app.App.return_code() -> int | NoneThe return code with which the app exited.
method
src.textual.app.App.run(*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) -> ReturnType | NoneRun the app.
method
src.textual.app.App.run_action(action:str | ActionParseResult, default_namespace:DOMNode | None=None, namespaces:Mapping[str, DOMNode] | None=None) -> boolPerform an [action](/guide/actions).
func
src.textual.app.App.run_app(app:App[ReturnType]) -> NoneRun the apps message loop.
method
src.textual.app.App.run_async(*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) -> ReturnType | NoneRun the app asynchronously.
func
src.textual.app.App.run_process_messages()The main message loop, invoke below.
method
src.textual.app.App.save_screenshot(filename:str | None=None, path:str | None=None, time_format:str | None=None) -> strSave an SVG screenshot of the current screen.
method
src.textual.app.App.screen() -> Screen[object]The current active screen.
method
src.textual.app.App.screen_stack() -> list[Screen[Any]]A snapshot of the current screen stack.
method
src.textual.app.App.search_commands(commands:Sequence[CommandListItem], placeholder:str='Search for commands…') -> AwaitMountShow a list of commands in the app.
method
src.textual.app.App.set_focus(widget:Widget | None, scroll_visible:bool=True) -> NoneFocus (or unfocus) a widget.
method
src.textual.app.App.set_keymap(keymap:Keymap) -> NoneSet the keymap, a mapping of binding IDs to key strings.
method
src.textual.app.App.simulate_key(key:str) -> NoneSimulate a key press.
method
src.textual.app.App.size() -> SizeThe size of the terminal.
method
src.textual.app.App.stop_animation(attribute:str, complete:bool=True) -> NoneStop an animation on an attribute.
method
src.textual.app.App.suspend() -> Iterator[None]A context manager that temporarily suspends the app.
method
src.textual.app.App.switch_mode(mode:str) -> AwaitMountSwitch to a given mode.
func
src.textual.app.App.take_screenshot() -> NoneTake a screenshot and exit.
method
src.textual.app.App.uninstall_screen(screen:Screen | str) -> str | NoneUninstall a screen.
method
src.textual.app.App.unregister_theme(theme_name:str) -> NoneUnregister a theme with the app.
method
src.textual.app.App.update_keymap(keymap:Keymap) -> NoneUpdate the App's keymap, merging with `keymap`.
method
src.textual.app.App.validate_sub_title(sub_title:Any) -> strMake sure the subtitle is set to a string.
method
src.textual.app.App.validate_title(title:Any) -> strMake sure the title is set to a string.
method
src.textual.app.App.viewport_size() -> SizeGet the viewport size (size of the screen).
method
src.textual.app.App.workers() -> WorkerManagerThe [worker](/guide/workers/) manager.
class
src.textual.app.AppErrorBase class for general App related exceptions.
class
src.textual.app.InvalidModeErrorRaised if there is an issue with a mode name.
class
src.textual.app.InvalidThemeErrorRaised when an invalid theme is set.
class
src.textual.app.ModeErrorBase class for exceptions related to modes.
class
src.textual.app.ScreenErrorBase class for exceptions that relate to screens.
class
src.textual.app.ScreenStackErrorRaised when trying to manipulate the screen stack incorrectly.
class
src.textual.app.SuspendNotSupportedRaised if suspending the application is not supported.
class
src.textual.app.UnknownModeErrorRaised when attempting to use a mode that is not known.
func
src.textual.app.get_system_commands_provider() -> type[SystemCommandsProvider]Callable to lazy load the system commands.
class
src.textual.await_remove.AwaitRemoveAn awaitable that waits for nodes to be removed.
func
src.textual.await_remove.AwaitRemove.await_prune() -> NoneWait for the prune operation to finish.
class
src.textual.binding.BindingThe configuration of a key binding.
class
src.textual.binding.BindingErrorA binding related error.
class
src.textual.binding.BindingsMapManage a set of bindings.
method
src.textual.binding.BindingsMap.apply_keymap(keymap:Keymap) -> KeymapApplyResultReplace bindings for keys that are present in `keymap`.
method
src.textual.binding.BindingsMap.bind(keys:str, action:str, description:str='', show:bool=True, key_display:str | None=None, priority:bool=False) -> NoneBind keys to an action.
method
src.textual.binding.BindingsMap.copy() -> BindingsMapReturn a copy of this instance.
method
src.textual.binding.BindingsMap.from_keys(keys:dict[str, list[Binding]]) -> BindingsMapConstruct a BindingsMap from a dict of keys and bindings.
method
src.textual.binding.BindingsMap.get_bindings_for_key(key:str) -> list[Binding]Get a list of bindings for a given key.
method
src.textual.binding.BindingsMap.merge(bindings:Iterable[BindingsMap]) -> BindingsMapMerge a bindings.
method
src.textual.binding.BindingsMap.shown_keys() -> list[Binding]A list of bindings for shown keys.
class
src.textual.binding.InvalidBindingBinding key is in an invalid format.
class
src.textual.binding.KeymapApplyResultThe result of applying a keymap.
class
src.textual.binding.NoBindingA binding was not found.
class
src.textual.box_model.BoxModelThe result of `get_box_model`.
method
src.textual.cache.FIFOCache.clear() -> NoneClear the cache.
method
src.textual.cache.FIFOCache.keys() -> KeysView[CacheKey]Get cache keys.
method
src.textual.cache.FIFOCache.set(key:CacheKey, value:CacheValue) -> NoneSet a value.
class
src.textual.cache.LRUCacheA dictionary-like container with a maximum size.
method
src.textual.cache.LRUCache.clear() -> NoneClear the cache.
method
src.textual.cache.LRUCache.discard(key:CacheKey) -> NoneDiscard item in cache from key.
method
src.textual.cache.LRUCache.grow(maxsize:int) -> NoneGrow the maximum size to at least `maxsize` elements.
method
src.textual.cache.LRUCache.keys() -> KeysView[CacheKey]Get cache keys.
method
src.textual.cache.LRUCache.set(key:CacheKey, value:CacheValue) -> NoneSet a value.
class
src.textual.canvas.CanvasA character canvas.
method
src.textual.canvas.Canvas.height() -> intThe canvas height.
method
src.textual.canvas.Canvas.render(primitives:Sequence[Primitive], base_style:Style) -> StripRenderableRender the canvas.
method
src.textual.canvas.Canvas.width() -> intThe canvas width.
method
src.textual.canvas.Canvas.x_range(start:int, end:int) -> rangeRange of x values, clipped to the canvas dimensions.
method
src.textual.canvas.Canvas.y_range(start:int, end:int) -> rangeRange of y values, clipped to the canvas dimensions.
class
src.textual.canvas.HorizontalLineA horizontal line.
class
src.textual.canvas.PrimitiveBase class for a canvas primitive.
method
src.textual.canvas.Primitive.render(canvas:Canvas) -> NoneRender to the canvas.
class
src.textual.canvas.RectangleA rectangle.
class
src.textual.canvas.VerticalLineA vertical line.
func
src.textual.case.camel_to_snake(name:str, _re_snake:Pattern[str]=re.compile('[a-z][A-Z]')) -> strConvert name from CamelCase to snake_case.
class
src.textual.clock.ClockAn object to get relative time.
method
src.textual.clock.Clock.clone() -> ClockClone the Clock with an independent time.
method
src.textual.clock.Clock.reset() -> NoneReset the clock.
method
src.textual.clock.Clock.time() -> floatTime since creation or reset.
class
src.textual.clock.MockClockA mock clock object where the time may be explicitly set.
method
src.textual.clock.MockClock.set_time(time:float) -> NoneSet the time for the clock.
method
src.textual.clock.MockClock.time() -> floatTime since creation or reset.
class
src.textual.color.ColorA class to represent a color.
method
src.textual.color.Color.automatic(alpha_percentage:float=100.0) -> ColorCreate an automatic color.
method
src.textual.color.Color.blend(destination:Color, factor:float, alpha:float | None=None) -> ColorGenerate a new color between two colors.
method
src.textual.color.Color.brightness() -> floatThe human perceptual brightness.
method
src.textual.color.Color.css() -> strThe color in CSS RGB or RGBA form.
method
src.textual.color.Color.darken(amount:float, alpha:float | None=None) -> ColorDarken the color by a given amount.
method
src.textual.color.Color.from_hsl(h:float, s:float, l:float) -> ColorCreate a color from HSL components.
method
src.textual.color.Color.from_hsv(h:float, s:float, v:float) -> ColorCreate a color from HSV components.
method
src.textual.color.Color.from_rich_color(rich_color:RichColor | None, theme:TerminalTheme | None=None, foreground:bool=True, ansi:bool=True) -> ColorCreate a new color from Rich's Color class.
method
src.textual.color.Color.get_contrast_text(alpha:float=0.95) -> ColorGet a light or dark color that best contrasts this color, for use with text.
method
src.textual.color.Color.hex6() -> strThe color in CSS hex form, with 6 digits for RGB.
method
src.textual.color.Color.hsl() -> HSLThis color in HSL format.
method
src.textual.color.Color.hsv() -> HSVThis color in HSV format.
method
src.textual.color.Color.inverse() -> ColorThe inverse of this color.
method
src.textual.color.Color.is_transparent() -> boolIs the color transparent (i.e.
method
src.textual.color.Color.lighten(amount:float, alpha:float | None=None) -> ColorLighten the color by a given amount.
method
src.textual.color.Color.monochrome() -> ColorA monochrome version of this color.
method
src.textual.color.Color.multiply_alpha(alpha:float) -> ColorCreate a new color, multiplying the alpha by a constant.
method
src.textual.color.Color.parse(color_text:str | Color) -> ColorParse a string containing a named color or CSS-style color.
method
src.textual.color.Color.rich_color() -> RichColorThis color encoded in Rich's Color class.
method
src.textual.color.Color.tint(color:Color) -> ColorApply a tint to a color.
method
src.textual.color.Color.with_alpha(alpha:float) -> ColorCreate a new color with the given alpha.
class
src.textual.color.ColorParseErrorA color failed to parse.
class
src.textual.color.GradientDefines a color gradient.
method
src.textual.color.Gradient.colors() -> list[Color]A list of colors in the gradient.
method
src.textual.color.Gradient.get_color(position:float) -> ColorGet a color from the gradient at a position between 0 and 1.
class
src.textual.color.HSLA color in HSL (Hue, Saturation, Lightness) format.
func
src.textual.color.HSL.as_str(number:float) -> strFormat a float.
method
src.textual.color.HSL.css() -> strHSL in css format.
class
src.textual.color.HSVA color in HSV (Hue, Saturation, Value) format.
class
src.textual.color.LabA color in CIE-L*ab format.
func
src.textual.color.lab_to_rgb(lab:Lab, alpha:float=1.0) -> ColorConvert a CIE-L*ab color to RGB.
func
src.textual.color.rgb_to_lab(rgb:Color) -> LabConvert an RGB color to the CIE-L*ab format.
class
src.textual.command.CommandInputThe command palette input control.
class
src.textual.command.CommandListThe command palette command list.
class
src.textual.command.CommandPaletteThe Textual command palette.
class
src.textual.command.CommandPalette.ClosedPosted to App when the command palette is closed.
class
src.textual.command.CommandPalette.OpenedPosted to App when the command palette is opened.
func
src.textual.command.CommandPalette.build_prompt() -> Iterable[Content]Generator for prompt content.
method
src.textual.command.CommandPalette.compose() -> ComposeResultCompose the command palette.
method
src.textual.command.CommandPalette.is_open(app:App[object]) -> boolIs a command palette current open?
class
src.textual.command.DiscoveryHitHolds the details of a single command search hit.
method
src.textual.command.DiscoveryHit.score() -> floatA discovery hit always has a score of 0.
class
src.textual.command.HitHolds the details of a single command search hit.
class
src.textual.command.ProviderBase class for command palette command providers.
method
src.textual.command.Provider.app() -> App[object]A reference to the application.
method
src.textual.command.Provider.discover() -> HitsA default collection of hits for the provider.
func
src.textual.command.Provider.post_init_task() -> NoneWrapper to post init that runs in a task.
method
src.textual.command.Provider.screen() -> Screen[object]The currently-active screen in the application.
method
src.textual.command.Provider.search(query:str) -> HitsA request to search for commands relevant to the given query.
method
src.textual.command.Provider.shutdown() -> NoneCalled when the Provider is shutdown.
class
src.textual.command.SearchIconWidget for displaying a search icon before the command input.
method
src.textual.command.SearchIcon.render() -> VisualTypeRender the icon.
class
src.textual.command.SimpleCommandA simple command.
class
src.textual.command.SimpleProviderA simple provider which the caller can pass commands to.
class
src.textual.containers.CenterA container which aligns children on the X axis.
class
src.textual.containers.CenterMiddleA container which aligns its children on both axis.
class
src.textual.containers.ContainerSimple container widget, with vertical layout.
class
src.textual.containers.GridA container with grid layout.
class
src.textual.containers.ItemGridA container with grid layout and automatic columns.
class
src.textual.containers.MiddleA container which aligns children on the Y axis.
class
src.textual.containers.RightA container which aligns children on the X axis.
class
src.textual.containers.VerticalAn expanding container with vertical layout and no scrollbars.
class
src.textual.content.ContentText content with marked up spans.
method
src.textual.content.Content.add_spans(spans:Sequence[Span]) -> ContentAdds spans to this Content instance.
method
src.textual.content.Content.append(content:Content | str) -> ContentAppend text or content to this content.
method
src.textual.content.Content.append_text(text:str, style:Style | str='') -> ContentAppend text give as a string, with an optional style.
method
src.textual.content.Content.blank(width:int, style:Style | str | None=None) -> ContentGet a Content instance consisting of spaces.
method
src.textual.content.Content.cell_length() -> intThe cell length of the content.
method
src.textual.content.Content.center(width:int, ellipsis:bool=False) -> ContentAlign a line to the center.
method
src.textual.content.Content.divide(offsets:Sequence[int]) -> list[Content]Divide the content at the given offsets.
method
src.textual.content.Content.empty() -> ContentGet an empty (blank) content
method
src.textual.content.Content.expand_tabs(tab_size:int=8) -> ContentConverts tabs to spaces.
method
src.textual.content.Content.first_line() -> ContentThe first line of the content.
method
src.textual.content.Content.from_markup(markup:str | Content, **variables:object) -> ContentCreate content from markup, optionally combined with template variables.
method
src.textual.content.Content.from_rich_text(text:str | Text, console:Console | None=None) -> ContentCreate equivalent Visual Content for str or Text.
method
src.textual.content.Content.from_text(markup_content_or_text:ContentText, markup:bool=True) -> ContentConstruct content from Text or str.
func
src.textual.content.Content.get_current_style() -> StyleConstruct current style from stack.
method
src.textual.content.Content.get_height(rules:RulesMap, width:int) -> intGet the height of the Visual if rendered at the given width.
method
src.textual.content.Content.get_minimal_width(rules:RulesMap) -> intMinimal width is the largest single word.
method
src.textual.content.Content.get_optimal_width(rules:RulesMap, container_width:int) -> intGet optimal width of the Visual to display its content.
method
src.textual.content.Content.get_style_at_offset(offset:int) -> StyleGet the style of a character at give offset.
method
src.textual.content.Content.is_same(content:Content) -> boolCompare to another Content object.
func
src.textual.content.Content.iter_content() -> Iterable[Content]Iterate the lines, optionally inserting the separator.
method
src.textual.content.Content.join(lines:Iterable[Content | str]) -> ContentJoin an iterable of content or strings.
method
src.textual.content.Content.pad(left:int, right:int, character:str=' ') -> ContentPad both the left and right edges with a given number of characters.
method
src.textual.content.Content.pad_left(count:int, character:str=' ') -> ContentPad the left with a given character.
method
src.textual.content.Content.pad_right(count:int, character:str=' ') -> ContentPad the right with a given character.
method
src.textual.content.Content.plain() -> strGet the text as a single string.
method
src.textual.content.Content.render_segments(base_style:Style=Style.null(), end:str='') -> list[Segment]Render the Content in to a list of segments.
method
src.textual.content.Content.render_strips(width:int, height:int | None, style:Style, options:RenderOptions) -> list[Strip]Render the Visual into an iterable of strips.
method
src.textual.content.Content.right(width:int, ellipsis:bool=False) -> ContentAlign a line to the right.
method
src.textual.content.Content.right_crop(amount:int=1) -> ContentRemove a number of characters from the end of the text.
method
src.textual.content.Content.rstrip(chars:str | None=None) -> ContentStrip characters from end of text.
method
src.textual.content.Content.rstrip_end(size:int) -> ContentRemove whitespace beyond a certain width at the end of the text.
method
src.textual.content.Content.simplify() -> ContentSimplify spans by joining contiguous spans together.
method
src.textual.content.Content.split(separator:str='\n', *include_separator:bool=False, *allow_blank:bool=False) -> list[Content]Split rich text into lines, preserving styles.
method
src.textual.content.Content.stylize(style:Style | str, start:int=0, end:int | None=None) -> ContentApply a style to the text, or a portion of the text.
method
src.textual.content.Content.stylize_before(style:Style | str, start:int=0, end:int | None=None) -> ContentApply a style to the text, or a portion of the text.
method
src.textual.content.Content.truncate(max_width:int, *ellipsis=False, *pad:bool=False) -> ContentTruncate the content at a given cell width.
method
src.textual.content.Content.without_spans() -> ContentThe content with no spans
method
src.textual.content.Content.wrap(width:int, *align:TextAlign='left', *overflow:TextOverflow='fold') -> list[Content]Wrap text so that it fits within the given dimensions.
class
src.textual.content.SpanA style applied to a range of character offsets.
method
src.textual.content.Span.extend(cells:int) -> 'Span'Extend the span by the given number of cells.
class
src.textual.coordinate.CoordinateAn object representing a row/column coordinate within a grid.
method
src.textual.coordinate.Coordinate.down() -> CoordinateGet the coordinate below.
method
src.textual.coordinate.Coordinate.left() -> CoordinateGet the coordinate to the left.
method
src.textual.coordinate.Coordinate.right() -> CoordinateGet the coordinate to the right.
method
src.textual.coordinate.Coordinate.up() -> CoordinateGet the coordinate above.
func
src.textual.css._error_tools.friendly_list(words:Iterable[str], joiner:str='or', omit_empty:bool=True) -> strGenerate a list of words as readable prose.
class
src.textual.css._style_properties.BooleanPropertyA property that requires a True or False value.
func
src.textual.css._style_properties.BorderProperty.check_refresh() -> NoneCheck if an update requires a layout
class
src.textual.css._style_properties.ColorPropertyDescriptor for getting and setting color properties.
class
src.textual.css._style_properties.DockPropertyDescriptor for getting and setting the dock property.
class
src.textual.css._style_properties.EdgesStores edges for border / outline.
method
src.textual.css._style_properties.Edges.spacing() -> SpacingGet spacing created by borders.
class
src.textual.css._style_properties.FractionalPropertyProperty that can be set either as a float (e.g.
class
src.textual.css._style_properties.HatchPropertyProperty to expose hatch style.
class
src.textual.css._style_properties.KeylinePropertyDescriptor for getting and setting keyline information.
class
src.textual.css._style_properties.LayoutPropertyDescriptor for getting and setting layout.
class
src.textual.css._style_properties.NamePropertyDescriptor for getting and setting name properties.
class
src.textual.css._style_properties.OffsetPropertyDescriptor for getting and setting the offset property.
class
src.textual.css._style_properties.ScalarListPropertyDescriptor for lists of scalars.
class
src.textual.css._style_properties.ScalarPropertyDescriptor for getting and setting scalar properties.
class
src.textual.css._style_properties.ScrollbarColorPropertyA descriptor to set scrollbar color(s).
class
src.textual.css._style_properties.SplitPropertyDescriptor for getting and setting the split property.
class
src.textual.css._style_properties.TransitionsPropertyDescriptor for getting transitions properties
About this data
These signatures were extracted from the public source of Textualize/textual
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.