wx_icons_hicolor.icon

Class to represent icons.

Classes:

Icon(name, path, size[, type, max_size, …])

Represents an icon.

class Icon(name, path, size, type='Threshold', max_size=None, min_size=None, theme='')[source]

Bases: Dictable

Represents an icon.

Parameters
  • name (str) – The name of the icon.

  • path (Union[str, Path, PathLike]) – The path to the icon.

  • size (int) – Nominal (unscaled) size of the icon.

  • type (Literal['Fixed', 'Scalable', 'Threshold']) – The type of icon sizes for the icon. Valid types are 'Fixed', 'Scalable' and 'Threshold'. The type decides what other keys in the section are used. Default 'Threshold'.

  • max_size (Optional[int]) – Specifies the maximum (unscaled) size that the icon can be scaled to. Defaults to the value of Size if not present.

  • min_size (Optional[int]) – Specifies the minimum (unscaled) size that the icon can be scaled to. Defaults to the value of Size if not present.

  • theme (str) – The name of the theme this icon came from. Default ''.

Methods:

__eq__(other)

Return self == other.

__repr__()

Return a string representation of the Icon.

as_base64_png([size])

Returns the icon as a base64-encoded object containing PNG image data.

as_bitmap([size])

Returns the icon as a wxPython bitmap.

as_png([size])

Returns the icon as a BytesIO object containing PNG image data.

Attributes:

mime_type

The mime type of the icon.

scalable

Whether the icon is scalable.

__eq__(other)[source]

Return self == other.

Return type

bool

__repr__()[source]

Return a string representation of the Icon.

Return type

str

as_base64_png(size=None)[source]

Returns the icon as a base64-encoded object containing PNG image data.

Return type

str

Returns

Base64-encoded string representing the PNG image.

as_bitmap(size=None)[source]

Returns the icon as a wxPython bitmap.

Parameters

size (Optional[int]) – Default None.

Return type

Bitmap

as_png(size=None)[source]

Returns the icon as a BytesIO object containing PNG image data.

Return type

BytesIO

Returns

io.BytesIO object representing the PNG image.

property mime_type

The mime type of the icon.

Return type

str

property scalable

Whether the icon is scalable.

Return type

bool