A wrapper module for various GUI usages
Project description
Weasel's GUI Spices
This is the one and only GUI module you really need...
Features
- Tray icons with custom sub-menus
- Windows Messages
- Qt Windows
- Windows Explorer extensions
- Borderless and draggable windows
- Easy custom CSS Styling
Tray Icons
This example creates a classic icon in the bottom right tray.
from PySide2.QtWidgets import QApplication, QMenu
from GUISpices import TrayIcon
import sys
# create main application (if not present)
app = QApplication([])
app.setQuitOnLastWindowClosed(False)
# configure basic tray actions
tray = TrayIcon(app, "examples/icon.png", "Test Program", click_action=lambda :print("Clicked"))
tray.add_menu_feature("Change Icon", lambda: tray.set_icon("examples/icon2.png"))
tray.add_menu_feature("Show a message from tray", lambda: tray.show_tray_message("Hello", "Hello my friend"))
tray.add_separator()
tray.add_menu_feature("Exit", app.exit)
# Include a custom sub-menu
menu_ = QMenu(title="Sub Menu")
menu_.addAction("Egg sit (sub-action)", lambda: sys.exit(0))
tray.add_menu(menu_)
sys.exit(app.exec_())
Windows Messages
This shows a tray icon and creates a windows tray message with a custom icon and action.
from PySide2.QtWidgets import QApplication, QMenu
from GUISpices import TrayIcon
import sys
# create main application (if not present)
app = QApplication([])
app.setQuitOnLastWindowClosed(False)
# configure basic tray
tray = TrayIcon(app, "examples/icon.png", "Test Program")
# Show message
tray.show_tray_message("Title","This is the message body",
icon="examples/icon.png",
on_click=lambda:print("Message clicked"))
sys.exit(app.exec_())
Qt Windows
The whole module lets you build all windows and popups with
Qt Designer, a powerful and easy-to-use environment for
drag & drop GUI building. This creates a .ui
file which can be directly loaded
to create the desired window with full compatibility.
from PySide2.QtWidgets import QApplication
from GUISpices import UIWindow
import sys
app = QApplication()
main_form = UIWindow('examples/wizard.ui', "examples/icon.png")
main_form.window.show()
sys.exit(app.exec_())
Windows Explorer extensions
This creates a new entry in the explorers context menu. So a right-click in any folder or on the user's desktop will show your custom action, as well. This example creates a custom action "Run CMD", which opens up a terminal.
from GUISpices import ExplorerContextManager
ExplorerContextManager.register_entry("Run CMD", "C:\\Windows\\System32\\cmd.exe", "C:\\Windows\\System32\\cmd.exe")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for GUISpices-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78b9561747b34b91ff4d31e8229dfa8f087272e567744f9b5c5831a863e4ac2e |
|
MD5 | 3f01b16d7c2c9a89307f281b78b770b7 |
|
BLAKE2b-256 | 1f8a5c61da82205227c100853d7fd376771f3ed003621d28558934fed7c8f0d9 |