inline
This module lets you run widgets as an inline terminal prompt.
inline(widget, *, exit_on=None, width=None)
Runs a widget as an inline terminal prompt.
This can be useful for adding GUI-like functionality within CLI scripts, as it gives you access to the widget system for building prompts, built in keyboard & mouse handling and everything else that makes PyTermGUI's WindowManager work, without the commitment to a full-screen app.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget |
T
|
Some widget that will be run. |
required |
width |
int | None
|
The width to set for the widget. If nothing is given, the widget's width is unchanged. |
None
|
Returns:
Type | Description |
---|---|
T
|
The same widget. This allows defining and running a prompt in the same line:
|
Source code in pytermgui/widgets/inline.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|