xnano.rendering
xnano.rendering
¶
xnano.rendering
Display styled values through a live runtime or print them as terminal text.
Functions:
-
clear_stream–Forget a named live-output stream.
-
get_stream_content–Return the text currently owned by a named stream.
-
render–Display renderables as print-like terminal output.
clear_stream
¶
Forget a named live-output stream.
Parameters:
Source code in xnano/rendering.py
get_stream_content
¶
Return the text currently owned by a named stream.
Parameters:
Returns:
-
str–Accumulated stream text, or an empty string when it does not exist.
Source code in xnano/rendering.py
render
¶
render(
*renderables: Any,
direction: Direction = "vertical",
foreground: ColorLike | None = None,
background: ColorLike | None = None,
modifiers: Sequence[CharacterModifier] | None = None,
horizontal_align: Alignment | None = None,
vertical_align: VerticalAlignment | None = None,
border: Border | None = None,
border_sides: Sequence[Side] | None = None,
border_color: ColorLike | None = None,
title: str | None = None,
title_position: FrameTitlePosition | None = None,
padding: PaddingLike | None = None,
gap: int = 0,
sep: str | None = " ",
end: str | None = "\n",
file: IO[str] | TextIO | None = None,
flush: bool = False,
stream: str | bool | None = None,
update: bool = False,
color: ColorLike | None = None,
align: Alignment | None = None
) -> None
Display renderables as print-like terminal output.
A live runtime paints the values into its current viewport. Otherwise
xnano uses an offscreen native terminal and writes the resulting cells to
file or standard output.
Parameters:
-
*renderables(Any, default:()) –Grids, components, content primitives, or plain values.
-
direction(Direction, default:'vertical') –Direction used to lay out multiple renderables.
-
foreground(ColorLike | None, default:None) –Foreground color applied to plain values.
-
background(ColorLike | None, default:None) –Background color for the rendered area.
-
modifiers(Sequence[CharacterModifier] | None, default:None) –Character modifiers applied to plain values.
-
horizontal_align(Alignment | None, default:None) –Horizontal alignment applied to plain values.
-
vertical_align(VerticalAlignment | None, default:None) –Vertical alignment applied to plain values.
-
border(Border | None, default:None) –Border style around the rendered area.
-
border_sides(Sequence[Side] | None, default:None) –Border sides to draw.
-
border_color(ColorLike | None, default:None) –Border foreground color.
-
title(str | None, default:None) –Optional border title.
-
title_position(FrameTitlePosition | None, default:None) –Border edge that holds the title.
-
padding(PaddingLike | None, default:None) –Space between the border and content.
-
gap(int, default:0) –Cells between multiple renderables.
-
sep(str | None, default:' ') –Separator used between horizontally arranged plain values.
-
end(str | None, default:'\n') –Text appended after the rendered output.
-
file(IO[str] | TextIO | None, default:None) –Text stream written outside a live runtime.
-
flush(bool, default:False) –Whether to flush the output stream after writing.
-
stream(str | bool | None, default:None) –Named append-or-replace output region.
-
update(bool, default:False) –Replace the named stream instead of appending to it.
Source code in xnano/rendering.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |