Pyloid Docs
GithubLanguage
  • 💎What is Pyloid?
  • Getting Started
    • Prerequisites
    • Create Pyloid App
  • Core Concepts
    • Thread Safety
  • API
    • Python (Backend)
      • Pyloid
      • BrowserWindow
      • Monitor
      • TrayEvent
      • Utility Functions
      • RPC
      • Store
    • Javascript (Frontend)
      • Event
      • BaseAPI
      • RPC
  • Guides
    • Load Webview
    • Serve Frontend
    • Calling Python from JS
    • Calling JS from Python
    • Keyboard Shotcuts
    • Notification
    • Tray
    • Timer
    • File Watcher
    • Clipboard
    • Window Position
    • Devtools
    • Window Drag Region
    • Window Radius And Transparent
    • Autostart
    • Production Utils
    • Desktop Monitor
    • File Dialog
    • Splash Screen
Powered by GitBook
On this page
  • Enumeration Members
  • Usage Example

Was this helpful?

Edit on GitHub
  1. API
  2. Python (Backend)

TrayEvent

TrayEvent is an enumeration (Enum) class that represents events related to the system tray icon. This class is mapped to QSystemTrayIcon.ActivationReason.

Enumeration Members

  • DoubleClick: Event that occurs when the tray icon is double-clicked

  • MiddleClick: Event that occurs when the tray icon is clicked with the middle button

  • RightClick: Event that occurs when the tray icon is clicked with the right button (context menu)

  • LeftClick: Event that occurs when the tray icon is clicked with the left button

  • Unknown: Unknown event

Usage Example

from pyloid import Pyloid, TrayEvent

app = Pyloid(app_name="Pyloid-App")

app.set_tray_icon("icons/icon.ico")

app.set_tray_actions(
    {
        TrayEvent.DoubleClick: lambda: print("Tray icon was double-clicked."),
        TrayEvent.MiddleClick: lambda: print("Tray icon was middle-clicked."),
        TrayEvent.RightClick: lambda: print("Tray icon was right-clicked."),
        TrayEvent.LeftClick: lambda: print("Tray icon was left-clicked."),
    }
)
PreviousMonitorNextUtility Functions

Last updated 6 months ago

Was this helpful?