如何使用python在ubuntu中显示默认的漂亮弹出消息?

2024-10-01 07:43:58 发布

您现在位置:Python中文网/ 问答频道 /正文

http://tinypic.com/r/5dv7kj/7 我怎样才能像图中那样显示信息(右上角)?在

我对linux不熟悉,现在正在尝试使用pygtk制作一个客户端应用程序来显示/弹出一些随机提示/mems。在

使用传统的winodw是可以的,但是这个对我来说更友好解决方案。其他在

有没有人能给我一些提示?任何python GUI库也可以。在


Tags: com应用程序http客户端linuxgui传统解决方案
2条回答

这是一个Ubuntu特有的东西,叫做NotifyOSD。这里有一些编程的例子here。在

python中的快速和脏代码

import pynotify

# Only Text Notification
pynotify.init('Basic')
pynotify.Notification("Title", "simple text").show()


# Lets try with an image
pynotify.init('Image')
## Use absolute Path of the photo
pynotify.Notification("Title", "My Photo here!!", "/home/nafis/Pictures/me.png").show()

# Try Markup 
pynotify.init("markup") ## all smallerCase "markup"
# but in parameter, first letter capital  
pynotify.Notification("Markup", 
  '''
  <b>bold</b>, <i>italic</i>, <u>underline</u>
  and even <a href="http://google.com">links</a> are supported!
  '''
).show()

您也可以从shell使用它(我使用lubuntu,它在这里工作)

^{pr2}$

相关问题 更多 >