python - 是否可以在 Windows 10 通知(python win10toast 模块)中添加下划线/粗体文本?
问题描述
我正在开发一个在完成时生成通知的程序。它是可点击的,我想通过在通知中加下划线或加粗“点击这里”来夸大这一点。这可能吗?如果它不是 win10toast 中的一个功能,我可以使用另一个模块吗?
解决方案
尝试:
from win10toast import ToastNotifier
def return_with_underline(x):
lst1 = []
for letter in x:
if letter != ' ':
lst1.append(letter)
lst1.append('\u0332')
else:
lst1.append(letter)
return '{:s}'.format(''.join(lst1))
toaster = ToastNotifier()
toaster.show_toast(return_with_underline('Click Here!'), "Hi", icon_path=None, duration=5)
这并不完美(不适用于空格),但您也可以使用其他 Unicode 字符,而不是\u03232
从这里得到这个(他们在谈论纯字符串,但它也在这里工作):
推荐阅读
- tfs - 如何在不升级原始服务器的情况下测试新的 TFS 服务器
- c# - 如何修复 IEnumerator WaitForSeconds 在 Unity C# 中不起作用
- openfiledialog - Avalonia 中的 OpenFileDialog - ShowAsync 出错
- c# - 将一个对象添加到多个数组并保持每个副本之间的差异?
- javascript - 如何将默认的“数据”值初始化为回调函数的返回值?
- javascript - 使用 PM2 运行 Typescript 应用程序
- javascript - JavaScript split method remove first 2 sections
- python - 如何解决''ComplexWarning:将复杂值转换为实数会丢弃虚部''?
- powershell - 已编辑注册表项,但仍禁用策略
- ag-grid - 如何将设置过滤器更新为 ag-grid v21?