Widget
Inherits: Gtk.Widget
and Service
Import: from fabric.widgets.widget import Widget
The base widget implementation, Nearly every other Fabric widget inherits consturctor properties, properties and methods from this widget. This makes it simple to make a modification that is reflected across all other widgets down the line.
Constructor Properties
Property | Type | Description |
---|---|---|
name | str | None = None | The name of this Widget. used for handling CSS properties (e.g. the a widget named “my-widget” can be selected using #my-widget in CSS.) |
visible | bool = True | Whether this Widget should be visible upon initialization or not. |
all_visible | bool = False | Whether this Widget and all of it’s children should be visible upon initialization or not. |
style | str | None = None | Inline CSS style to be applied on this widget. |
tooltip_text | str | None = None | Tooltip (hover popup) text |
tooltip_markup | str | None = None | Tooltip (hover popup) markup (defined in Pango’s markup standard.) |
h_align | Literal["fill", "start", "end", "center", "baseline"] | Gtk.Align | None = None | The horizontal alignment style. |
v_align | Literal["fill", "start", "end", "center", "baseline"] | Gtk.Align | None = None | The vertical alignment style. |
h_expand | bool = False | Whether this Widget should expand on the horizontal axis or not. |
v_expand | bool = False | Whether this Widget should expand on the vertical axis or not. |
size | Iterable[int] | int | None = None | The size of this Widget to initially allocate (a single int to be used for both width and height or a tuple of (width, height) .) |
Public Methods
-
set_style
: Apply a string of CSS styles on the Widget. -
set_cursor
: Change the stlye of the cursor (pointer) to a named cursor or aPixbuf
. -
set_alignment
: Set the alignment mode for a given orientation. -
add_events
: Add a new event(s) mask (for widget with an events window.) -
add_style_class
: Add a CSS style class from this widget, a style class can be used to reference a widget that has a specific state in CSS (e.g.#my-widget .my-class
.) -
remove_style_class
: Remove a CSS style class from this widget. -
is_hovered
: Get whether thisWidget
is currently begin hovered or not.