textual.types
Export some objects that are used by Textual and that help document other features.
ActionParseResult
module-attribute
¶
An action is its name and the arbitrary tuple of its arguments.
AnimationLevel
module-attribute
¶
AnimationLevel = Literal['none', 'basic', 'full']
The levels that the TEXTUAL_ANIMATIONS
env var can be set to.
CSSPathType
module-attribute
¶
Valid ways of specifying paths to CSS files.
CallbackType
module-attribute
¶
Type used for arbitrary callables used in callbacks.
Direction
module-attribute
¶
Direction = Literal[-1, 1]
Valid values to determine navigation direction.
In a vertical setting, 1 points down and -1 points up. In a horizontal setting, 1 points right and -1 points left.
EasingFunction
module-attribute
¶
Signature for a function that parametrizes animation speed.
An easing function must map the interval [0, 1] into the interval [0, 1].
IgnoreReturnCallbackType
module-attribute
¶
A callback which ignores the return type.
InputValidationOn
module-attribute
¶
Possible messages that trigger input validation.
OptionListContent
module-attribute
¶
Types accepted in OptionList constructor and [add_options()][textual.widgets.OptionList.ads_options].
PlaceholderVariant
module-attribute
¶
The different variants of placeholder.
SelectType
module-attribute
¶
SelectType = TypeVar('SelectType')
The type used for data in the Select.
WatchCallbackType
module-attribute
¶
WatchCallbackType = Union[
WatchCallbackBothValuesType,
WatchCallbackNewValueType,
WatchCallbackNoArgsType,
]
Type used for callbacks passed to the watch
method of widgets.
Animatable
¶
Bases: Protocol
Protocol for objects that can have their intrinsic values animated.
For example, the transition between two colors can be animated
because the class Color
satisfies this protocol.
DirEntry
dataclass
¶
Attaches directory information to a DirectoryTree
node.
DuplicateID
¶
Bases: OptionListError
Raised if a duplicate ID is used when adding options to an option list.
MessageTarget
¶
Bases: Protocol
Protocol that must be followed by objects that can receive messages.
NoActiveAppError
¶
Bases: RuntimeError
Runtime error raised if we try to retrieve the active app when there is none.
NoSelection
¶
Used by the Select
widget to flag the unselected state. See Select.BLANK
.
OptionDoesNotExist
¶
Bases: OptionListError
Raised when a request has been made for an option that doesn't exist.
RenderStyles
¶
Bases: StylesBase
Presents a combined view of two Styles object: a base Styles and inline Styles.
gutter
property
¶
animate
¶
animate(
attribute,
value,
*,
final_value=...,
duration=None,
speed=None,
delay=0.0,
easing=DEFAULT_EASING,
on_complete=None,
level="full"
)
Animate an attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
Name of the attribute to animate. |
required |
|
str | float | Animatable
|
The value to animate to. |
required |
|
object
|
The final value of the animation. Defaults to |
...
|
|
float | None
|
The duration (in seconds) of the animation. |
None
|
|
float | None
|
The speed of the animation. |
None
|
|
float
|
A delay (in seconds) before the animation starts. |
0.0
|
|
EasingFunction | str
|
An easing method. |
DEFAULT_EASING
|
|
CallbackType | None
|
A callable to invoke when the animation is finished. |
None
|
|
AnimationLevel
|
Minimum level required for the animation to take place (inclusive). |
'full'
|
has_any_rules
¶
UnusedParameter
¶
Helper type for a parameter that isn't specified in a method call.