MCPcopy Create free account
hub / github.com/PyQt5/PyQt / __init__

Method __init__

QSystemTrayIcon/TrayNotify.py:24–36  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

22class Window(QWidget):
23
24 def __init__(self, *args, **kwargs):
25 super(Window, self).__init__(*args, **kwargs)
26 layout = QHBoxLayout(self)
27 layout.addWidget(QPushButton('开始闪烁', self, clicked=self.start_flash))
28 layout.addWidget(QPushButton('停止闪烁', self, clicked=self.stop_flash))
29 # 创建托盘图标
30 self.tray_icon = QSystemTrayIcon(self)
31 self.tray_icon.setIcon(self.style().standardIcon(
32 QStyle.SP_ComputerIcon))
33 self.tray_icon.show()
34 # 图标闪烁定时器
35 self.tray_visible = True
36 self.flash_timer = QTimer(self, timeout=self.flash_icon)
37
38 def closeEvent(self, event):
39 self.stop_flash()

Callers

nothing calls this directly

Calls 3

addWidgetMethod · 0.80
setIconMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected