Skip to main content

A polished macOS-style toast notification widget for PySide6

Project description

wc_toast

一个独立、轻量的 PySide6 弱提示组件,视觉参考 macOS 通知中心。

特性

  • 浅色半透明圆角通知卡片
  • 成功、信息、警告、错误和默认主题
  • 滑入、回弹、淡出动画
  • 同一位置多条通知自动堆叠
  • 支持操作按钮、关闭按钮和自动消失
  • 不依赖 pyqttoast
  • 支持七个预设位置

安装

pip install wc_toast

快速使用

from PySide6.QtWidgets import QApplication
from wc_toast import Toast, ToastPosition

app = QApplication([])

Toast.success(
    "保存成功",
    "项目文件已经保存。",
    position=ToastPosition.TOP_RIGHT,
)

app.exec()

可用位置

ToastPosition.TOP_LEFT       # 顶部靠左
ToastPosition.TOP_MIDDLE     # 顶部中间
ToastPosition.TOP_RIGHT      # 顶部靠右
ToastPosition.MIDDLE_LOWER   # 屏幕中间偏下
ToastPosition.BOTTOM_LEFT    # 底部靠左
ToastPosition.BOTTOM_MIDDLE  # 底部中间
ToastPosition.BOTTOM_RIGHT   # 底部靠右

完整配置

from wc_toast import Toast, ToastPosition, ToastPreset

toast = Toast()
toast.setPreset(ToastPreset.INFORMATION)
toast.setTitle("处理完成")
toast.setText("文件已经导入,可以继续下一步。")
toast.setDuration(3000)
toast.setPosition(ToastPosition.MIDDLE_LOWER)
toast.setAction("查看详情", lambda: print("查看"))
toast.show()

duration=0 时通知不会自动关闭。

本地演示

python -m wc_toast.toast

许可证

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wc_toast-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wc_toast-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file wc_toast-0.1.0.tar.gz.

File metadata

  • Download URL: wc_toast-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for wc_toast-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6fe0c27254283d04ed381290c477b732cf518e1165e9eb52b8b31fcc371186ed
MD5 b6d51e9adaa9db379fd532e40a02dcde
BLAKE2b-256 804a777a91eebfb31311f919d19483d72937009e89aafa0940291917e8bfa477

See more details on using hashes here.

File details

Details for the file wc_toast-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wc_toast-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for wc_toast-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45cbc9d1ddc1f134a356a0c4a6190f68f87376094e96cf67ebd70ce1cbbaec42
MD5 cbd1c66f7d2c7a8111eab8a26d97108e
BLAKE2b-256 214e1531c35e2bdd96f7ee44431595cb5d2195430e2508057ff72247642e2bcc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page