icon#

Module Contents#

FluentIconEngine

Fluent icon engine

SvgIconEngine

Svg icon engine

FluentIconBase

流畅图标基类

FluentIcon

流畅图标

Icon

Action

Fluent action

getIconColor([theme, reverse])

根据主题获取图标颜色

drawSvgIcon(icon, painter, rect)

绘制 svg 图标

writeSvg(iconPath[, indexes])

向 svg 图标的路径写入属性值

drawIcon(icon, painter, rect[, state])

绘制图标

toQIcon(→ PyQt5.QtGui.QIcon)

convet icon to QIcon

class FluentIconEngine(icon, reverse=False)#

Bases: PyQt5.QtGui.QIconEngine

Fluent icon engine

paint(painter, rect, mode, state)#
class SvgIconEngine(svg: str)#

Bases: PyQt5.QtGui.QIconEngine

Svg icon engine

paint(painter, rect, mode, state)#
clone() PyQt5.QtGui.QIconEngine#
pixmap(size, mode, state)#
getIconColor(theme=Theme.AUTO, reverse=False)#

根据主题获取图标颜色

drawSvgIcon(icon, painter, rect)#

绘制 svg 图标

参数#

icon: str | bytes | QByteArray

图标路径或者 svg 图标代码

painter: QPainter

painter

rect: QRect | QRectF

渲染图标的矩形区域

writeSvg(iconPath: str, indexes=None, **attributes)#

向 svg 图标的路径写入属性值

参数#

iconPath: str

svg 图标路径

indexes: List[int]

将被写入属性值的图形路径索引,如果为 None,所有路径都会被写入属性值

**attributes:

图形路径的属性值

返回值#

svg: str

svg 代码

drawIcon(icon, painter, rect, state=QIcon.Off, **attributes)#

绘制图标

参数#

icon: str | QIcon | FluentIconBaseBase

将被绘制的图标

painter: QPainter

painter

rect: QRect | QRectF

渲染图标的矩形区域

**attribute:

svg 图标属性

class FluentIconBase#

流畅图标基类

abstract path(theme=Theme.AUTO) str#

返回图标路径

参数#

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

icon(theme=Theme.AUTO, color: PyQt5.QtGui.QColor = None) PyQt5.QtGui.QIcon#

create a fluent icon

参数#

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on qconfig.theme

color: QColor | Qt.GlobalColor | str

icon color, only applicable to svg icon

qicon(reverse=False) PyQt5.QtGui.QIcon#

convert to QIcon, the theme of icon will be updated synchronously with app

参数#

reverse: bool

whether to reverse the theme of icon

render(painter, rect, theme=Theme.AUTO, indexes=None, **attributes)#

绘制 svg 图标

参数#

painter: QPainter

painter

rect: QRect | QRectF

渲染图标的矩形区域

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

indexes: List[int]

将被写入属性值的图形路径索引,如果为 None,所有路径都会被写入属性值

**attributes:

图形路径的属性值

class FluentIcon#

Bases: FluentIconBase, enum.Enum

流畅图标

UP = 'Up'#
ADD = 'Add'#
BUS = 'Bus'#
CAR = 'Car'#
CUT = 'Cut'#
IOT = 'IOT'#
PIN = 'Pin'#
TAG = 'Tag'#
VPN = 'VPN'#
CAFE = 'Cafe'#
CHAT = 'Chat'#
COPY = 'Copy'#
CODE = 'Code'#
DOWN = 'Down'#
EDIT = 'Edit'#
FLAG = 'Flag'#
FONT = 'Font'#
GAME = 'Game'#
HELP = 'Help'#
HIDE = 'Hide'#
HOME = 'Home'#
INFO = 'Info'#
LEAF = 'Leaf'#
MAIL = 'Mail'#
MENU = 'Menu'#
MUTE = 'Mute'#
MORE = 'More'#
MOVE = 'Move'#
PLAY = 'Play'#
SAVE = 'Save'#
SEND = 'Send'#
SYNC = 'Sync'#
UNIT = 'Unit'#
VIEW = 'View'#
WIFI = 'Wifi'#
ZOOM = 'Zoom'#
ALBUM = 'Album'#
BRUSH = 'Brush'#
BROOM = 'Broom'#
CLOSE = 'Close'#
CLOUD = 'Cloud'#
EMBED = 'Embed'#
GLOBE = 'Globe'#
HEART = 'Heart'#
LABEL = 'Label'#
MEDIA = 'Media'#
MOVIE = 'Movie'#
MUSIC = 'Music'#
ROBOT = 'Robot'#
PAUSE = 'Pause'#
PASTE = 'Paste'#
PHOTO = 'Photo'#
PHONE = 'Phone'#
PRINT = 'Print'#
SHARE = 'Share'#
TILES = 'Tiles'#
UNPIN = 'Unpin'#
VIDEO = 'Video'#
TRAIN = 'Train'#
ADD_TO = 'AddTo'#
ACCEPT = 'Accept'#
CAMERA = 'Camera'#
CANCEL = 'Cancel'#
DELETE = 'Delete'#
FOLDER = 'Folder'#
FILTER = 'Filter'#
MARKET = 'Market'#
SCROLL = 'Scroll'#
LAYOUT = 'Layout'#
GITHUB = 'GitHub'#
UPDATE = 'Update'#
REMOVE = 'Remove'#
RETURN = 'Return'#
PEOPLE = 'People'#
QRCODE = 'QRCode'#
RINGER = 'Ringer'#
ROTATE = 'Rotate'#
SEARCH = 'Search'#
VOLUME = 'Volume'#
FRIGID = 'Frigid'#
SAVE_AS = 'SaveAs'#
ZOOM_IN = 'ZoomIn'#
CONNECT = 'Connect'#
HISTORY = 'History'#
SETTING = 'Setting'#
PALETTE = 'Palette'#
MESSAGE = 'Message'#
FIT_PAGE = 'FitPage'#
ZOOM_OUT = 'ZoomOut'#
AIRPLANE = 'Airplane'#
ASTERISK = 'Asterisk'#
CALORIES = 'Calories'#
CALENDAR = 'Calendar'#
FEEDBACK = 'Feedback'#
LIBRARY = 'BookShelf'#
MINIMIZE = 'Minimize'#
CHECKBOX = 'CheckBox'#
DOCUMENT = 'Document'#
LANGUAGE = 'Language'#
DOWNLOAD = 'Download'#
QUESTION = 'Question'#
SPEAKERS = 'Speakers'#
DATE_TIME = 'DateTime'#
FONT_SIZE = 'FontSize'#
HOME_FILL = 'HomeFill'#
PAGE_LEFT = 'PageLeft'#
SAVE_COPY = 'SaveCopy'#
SEND_FILL = 'SendFill'#
SKIP_BACK = 'SkipBack'#
SPEED_OFF = 'SpeedOff'#
ALIGNMENT = 'Alignment'#
BLUETOOTH = 'Bluetooth'#
COMPLETED = 'Completed'#
CONSTRACT = 'Constract'#
HEADPHONE = 'Headphone'#
MEGAPHONE = 'Megaphone'#
PROJECTOR = 'Projector'#
EDUCATION = 'Education'#
LEFT_ARROW = 'LeftArrow'#
ERASE_TOOL = 'EraseTool'#
PAGE_RIGHT = 'PageRight'#
PLAY_SOLID = 'PlaySolid'#
BOOK_SHELF = 'BookShelf'#
HIGHTLIGHT = 'Highlight'#
FOLDER_ADD = 'FolderAdd'#
PAUSE_BOLD = 'PauseBold'#
PENCIL_INK = 'PencilInk'#
PIE_SINGLE = 'PieSingle'#
QUICK_NOTE = 'QuickNote'#
SPEED_HIGH = 'SpeedHigh'#
STOP_WATCH = 'StopWatch'#
ZIP_FOLDER = 'ZipFolder'#
BASKETBALL = 'Basketball'#
BRIGHTNESS = 'Brightness'#
DICTIONARY = 'Dictionary'#
MICROPHONE = 'Microphone'#
ARROW_DOWN = 'ChevronDown'#
FULL_SCREEN = 'FullScreen'#
MIX_VOLUMES = 'MixVolumes'#
REMOVE_FROM = 'RemoveFrom'#
RIGHT_ARROW = 'RightArrow'#
QUIET_HOURS = 'QuietHours'#
FINGERPRINT = 'Fingerprint'#
APPLICATION = 'Application'#
CERTIFICATE = 'Certificate'#
TRANSPARENT = 'Transparent'#
IMAGE_EXPORT = 'ImageExport'#
SPEED_MEDIUM = 'SpeedMedium'#
LIBRARY_FILL = 'LibraryFill'#
MUSIC_FOLDER = 'MusicFolder'#
POWER_BUTTON = 'PowerButton'#
SKIP_FORWARD = 'SkipForward'#
CARE_UP_SOLID = 'CareUpSolid'#
ACCEPT_MEDIUM = 'AcceptMedium'#
CANCEL_MEDIUM = 'CancelMedium'#
CHEVRON_RIGHT = 'ChevronRight'#
CLIPPING_TOOL = 'ClippingTool'#
SEARCH_MIRROR = 'SearchMirror'#
SHOPPING_CART = 'ShoppingCart'#
FONT_INCREASE = 'FontIncrease'#
BACK_TO_WINDOW = 'BackToWindow'#
COMMAND_PROMPT = 'CommandPrompt'#
CLOUD_DOWNLOAD = 'CloudDownload'#
DICTIONARY_ADD = 'DictionaryAdd'#
CARE_DOWN_SOLID = 'CareDownSolid'#
CARE_LEFT_SOLID = 'CareLeftSolid'#
CLEAR_SELECTION = 'ClearSelection'#
DEVELOPER_TOOLS = 'DeveloperTools'#
BACKGROUND_FILL = 'BackgroundColor'#
CARE_RIGHT_SOLID = 'CareRightSolid'#
CHEVRON_DOWN_MED = 'ChevronDownMed'#
CHEVRON_RIGHT_MED = 'ChevronRightMed'#
EMOJI_TAB_SYMBOLS = 'EmojiTabSymbols'#
EXPRESSIVE_INPUT_ENTRY = 'ExpressiveInputEntry'#
path(theme=Theme.AUTO)#

返回图标路径

参数#

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

class Icon(fluentIcon: FluentIcon)#

Bases: PyQt5.QtGui.QIcon

toQIcon(icon: PyQt5.QtGui.QIcon | FluentIconBase | str) PyQt5.QtGui.QIcon#

convet icon to QIcon

class Action(parent: PyQt5.QtCore.QObject = None, **kwargs)#

Bases: PyQt5.QtWidgets.QAction

Fluent action

Constructors#

  • Action(parent: QWidget = None, **kwargs)

  • Action(text: str, parent: QWidget = None, **kwargs)

  • Action(icon: QIcon | FluentIconBase, parent: QWidget = None, **kwargs)

icon() PyQt5.QtGui.QIcon#
setIcon(icon: FluentIconBase | PyQt5.QtGui.QIcon)#