Pyloid
Pyloid is a high-level desktop application framework built on top of PySide6. It simplifies window creation, system tray management, clipboard interaction, RPC communication, file watching, and more. All functions in Pyloid are thread-safe, meaning they can be safely executed from threads other than the main thread.
Initialization
Parameters
app_name :
str
Name of the application (used for auto-start and single-instance logic).single_instance :
bool
, optional, default:True
Whether to enforce a single running instance.
Returns
Pyloid
: The initialized application instance.
Window Management
create_window
create_window
Parameters
title :
str
, optional, default: "pylon app" Title of the window.width :
int
, optional, default:800
Width of the window.height :
int
, optional, default:600
Height of the window.x :
int
, optional, default:200
X position of the window.y :
int
, optional, default:200
Y position of the window.frame :
bool
, optional, default:True
Whether the window has a visible frame.context_menu :
bool
, optional, default:False
Whether to enable right-click context menu.dev_tools :
bool
, optional, default:False
Whether to enable developer tools.rpc :
Optional[PyloidRPC]
, optional RPC instance for JavaScript communication.
Returns
BrowserWindow
: The created browser window.
get_windows
get_windows
Returns
Dict[str, BrowserWindow]
: Dictionary of all open windows.
get_window_by_id
get_window_by_id
Parameters
window_id :
str
ID of the window to retrieve.
Returns
Optional[BrowserWindow]
: Window object or None.
show_main_window
, focus_main_window
, show_and_focus_main_window
, close_all_windows
, quit
show_main_window
, focus_main_window
, show_and_focus_main_window
, close_all_windows
, quit
Each of these methods takes no parameters and returns None
.
Tray System
set_tray_icon
set_tray_icon
Parameters
tray_icon_path :
str
Path to the tray icon file.
Returns
bool
: True if successful.
set_tray_menu_items
set_tray_menu_items
Parameters
tray_menu_items :
List[Dict[str, Union[str, Callable]]]
Menu items to add to the tray context menu.
Returns
bool
: True if successful.
show_notification
show_notification
Parameters
title :
str
message :
str
Returns
bool
: True if successful.
Clipboard
set_clipboard_text
set_clipboard_text
Parameters
text :
str
Returns
None
get_clipboard_text
get_clipboard_text
Returns
str
: Clipboard text.
set_clipboard_image
set_clipboard_image
Parameters
image :
Union[str, bytes, os.PathLike]
Image file path or data.
Returns
None
get_clipboard_image
get_clipboard_image
Returns
Optional[QImage]
: Clipboard image object.
Autostart
set_auto_start
set_auto_start
Parameters
enable :
bool
Returns
Union[bool, None]
: True if enabled, False if disabled, None if unsupported.
is_auto_start
is_auto_start
Returns
bool
: Whether auto-start is active.
File Watcher
watch_file
, watch_directory
, stop_watching
watch_file
, watch_directory
, stop_watching
Each takes a str
path and returns bool
.
get_watched_paths
, get_watched_files
, get_watched_directories
get_watched_paths
, get_watched_files
, get_watched_directories
Returns
List[str]
: Watched paths or files or directories.
remove_all_watched_paths
remove_all_watched_paths
Returns
None
set_file_change_callback
, set_directory_change_callback
set_file_change_callback
, set_directory_change_callback
Parameters
callback :
Callable[[str], None]
Returns
None
File Dialogs
open_file_dialog
open_file_dialog
Parameters
dir :
Optional[str]
Initial directory.filter :
Optional[str]
Filter for file types.
Returns
Optional[str]
: Selected file path or None.
save_file_dialog
save_file_dialog
Same parameters and return type as open_file_dialog
.
select_directory_dialog
select_directory_dialog
Parameters
dir :
Optional[str]
Initial directory.
Returns
Optional[str]
: Selected directory path or None.
Platform Dirs
Each returns a str
path to the respective directory:
user_data_dir()
site_data_dir()
user_cache_dir()
user_log_dir()
user_documents_dir()
user_downloads_dir()
user_pictures_dir()
user_videos_dir()
user_music_dir()
user_desktop_dir()
user_runtime_dir()
Store API
store
store
Parameters
path :
str
File name of the store.user_data_dir :
bool
, optional, default:True
Whether to place the file inside the user data directory.
Returns
Store
: Store object supporting.set()
and.get()
.
Run the App
Returns
None
: Starts the application event loop.
Last updated
Was this helpful?