跳转至

maliang.standard.styles

字数 9 个   阅读时间不到 1 分钟   访问量

源代码:maliang/standard/styles.py

All standard Style classes

类:

TextStyle

TextStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of Text

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    fg: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • fg: the foreground color of the widget

states: “normal”

LabelStyle

LabelStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of Label

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    fg: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • fg: the foreground color of the widget.
  • bg: the background color of the widget.
  • ol: the outline color of the widget.

states: “normal”, “hover”

ButtonStyle

ButtonStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: LabelStyle

Style of Button

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    fg: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • fg: the foreground color of the widget.
  • bg: the background color of the widget.
  • ol: the outline color of the widget.

states: “normal”, “hover”, “active”

SwitchStyle

SwitchStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of Switch

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    bg_slot: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol_slot: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg_dot: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol_dot: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • bg_slot: the background color of the widget.
  • ol_slot: the outline color of the widget.
  • bg_dot: the inside background color of the widget.
  • ol_dot: the inside outline color of the widget.

states: “normal-off”, “hover-off”, “active-off”, “normal-on”, “hover-on”, “active-on”

InputBoxStyle

InputBoxStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of InputBox

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    fg: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg_bar: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • fg: the foreground color of the widget.
  • bg: the background color of the widget.
  • ol: the outline color of the widget.
  • bg_bar: the highlight bar of the widget (Only for Windows11 theme)

states: “normal”, “hover”, “active”

ToggleButtonStyle

ToggleButtonStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of ToggleButton

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    fg: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • fg: the foreground color of the widget.
  • bg: the background color of the widget.
  • ol: the outline color of the widget.

states: “normal-off”, “hover-off”, “active-off”, “normal-on”, “hover-on”, “active-on”

CheckBoxStyle

CheckBoxStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: ToggleButtonStyle

Style of CheckBox

RadioBoxStyle

RadioBoxStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of RadioGroup

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    bg_box: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol_box: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg_dot: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol_dot: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • bg_box: the background color of the widget.
  • ol_box: the outline color of the widget.
  • bg_dot: the inside background color of the widget.
  • ol_dot: the inside outline color of the widget.

states: “normal”, “hover”, “active”

ProgressBarStyle

ProgressBarStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of ProgressBar

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    bg_slot: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol_slot: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg_bar: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol_bar: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • bg_slot: the background color of the widget.
  • ol_slot: the outline color of the widget.
  • bg_bar: the inside background color of the widget.
  • ol_bar: the inside outline color of the widget.

states: “normal”, “hover”

UnderlineButtonStyle

UnderlineButtonStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: TextStyle

Style of UnderlineButton

HighlightButtonStyle

HighlightButtonStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: TextStyle

Style of HighlightButtonStyle

IconButtonStyle

IconButtonStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: LabelStyle

Style of IconButtonStyle

SliderStyle

SliderStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of Slider

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    fg_slot: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg_slot: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg_pnt: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg_dot: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • fg_slot: the foreground color of the widget.
  • bg_slot: the background color of the widget.
  • bg_pnt: the pointer color of the widget.
  • bg_dot: the pointer highlight part color of the widget (Only for Windows11 theme).

states: “normal”, “hover”, “active”

SegmentedButtonStyle

SegmentedButtonStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of SegmentedButton

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    bg: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • bg: the background color of the widget.
  • ol: the outline color of the widget.

states: “normal”, “hover”

ToggleButtonStyle4SB

ToggleButtonStyle4SB(widget: Widget, *, auto_update: bool | None = None)

Bases: ToggleButtonStyle

style of ToggelButton for SegmentedButton

OptionButtonStyle

OptionButtonStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of OptionButton

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    bg: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • bg: the background color of the widget.
  • ol: the outline color of the widget.

states: “normal”, “hover”, “active”

SpinnerStyle

SpinnerStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of Spinner

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    fg: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • fg: the foreground color of the widget.
  • bg: the background color of the widget.

states: “normal”

TooltipStyle

TooltipStyle(widget: Widget, *, auto_update: bool | None = None)

Bases: virtual.Style

Style of Tooltip

方法:

  • set

    Set the style of the widget.

set

set(
    theme: typing.Literal["light", "dark"] | None = None,
    *,
    fg: tuple[str | types.EllipsisType, ...] | str | None = None,
    bg: tuple[str | types.EllipsisType, ...] | str | None = None,
    ol: tuple[str | types.EllipsisType, ...] | str | None = None
) -> None

Set the style of the widget.

  • theme: the theme name, None indicates both
  • fg: the foreground color of the widget.
  • bg: the background color of the widget.
  • ol: the outline color of the widget.

states: “normal”