win11_notificationbar
Project description
Windows 11 通知栏通知系统
简介
本项目旨在实现一个基于Windows 11的通知栏通知系统。通过使用winsdk
库,我们可以创建丰富的通知消息,并支持多种交互方式,如按钮点击、输入框、进度条等。
目录
安装依赖
在开始之前,确保已经安装了所需的依赖库。可以通过以下命令安装:
pip install winsdk
pip install pywin32
核心功能
创建通知
使用notify
函数创建一个基本的通知:
notify(title="Hello", body="This is a notification", inputs=["Enter your name"])
添加图标
设置通知的图标:
notify(title="Hello", body="This is a notification", icon="path/to/icon.png")
添加图片
在通知中添加图片:
notify(title="Hello", body="This is a notification", image="path/to/image.png")
添加进度条
显示进度条:
notify(title="Hello", body="This is a notification", progress={"value": "50"})
添加音频
播放音频文件:
notify(title="Hello", body="This is a notification", audio="path/to/audio.mp3")
添加按钮
添加按钮以实现用户交互:
notify(title="Hello", body="This is a notification", button="Click me")
添加输入框
添加输入框以获取用户输入:
notify(title="Hello", body="This is a notification", input="Enter your name")
添加选择框
添加选择框以供用户选择:
notify(title="Hello", body="This is a notification", selection=["Option 1", "Option 2"])
异步通知
使用toast
函数创建异步通知,支持更复杂的交互逻辑:
from packaging_tutorial.win11_notificationbar.win11_notificationbar import notify
notify(
title="标题",
body="内容",
icon="https://example.com/icon.png",
image="https://example.com/image.png",
button="点击我",
input="输入框",
progress={"value": "0.5", "status": "进行中"},
# audio="ms-winsoundevent:Notification.Looping.Alarm",
on_click=lambda: print("点击了通知"),
)
更新进度
动态更新通知中的进度条:
update_progress({"value": "75"})
总结
通过本项目,我们实现了在Windows 11中创建丰富且交互性强的通知系统。这些功能可以帮助开发者更好地与用户进行互动,提升用户体验。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file win11_notificationbar-0.0.2.tar.gz
.
File metadata
- Download URL: win11_notificationbar-0.0.2.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa46fa78b6abb49c2853273957b95f1e3061d5e5bbe4b510493b54a0462da828 |
|
MD5 | 2bfbf89ab0c5fa0cd11d39108befe92b |
|
BLAKE2b-256 | 2ff3423c7954a1bd28f1516e7363257a13760ae4318aaa44909a6a6c725fa53e |
File details
Details for the file win11_notificationbar-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: win11_notificationbar-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | faab65f511404b484aadc0d419f1b57ca5e1f3e26a8411a37c3b39aa61cc67fa |
|
MD5 | a931acf6b19624cd8c686aed04222301 |
|
BLAKE2b-256 | f206d2e43f519153fce797af09fc90cf6d2eeb15997396fe2c70807cf75e92d7 |