A Python library that can pop up custom bubble notifications
bubble.py是可以导入的库,example.py是程序使用的一个示例
bubble.py is a library that can be imported, and example.py is an example used by the program.
1.导入库(Import library)
import tkinter as tk
from bubble import BubbleBox
2.创建窗体实例(Create a form instance)
import tkinter as tk
from bubble import BubbleBox
root = tk.Tk()
root.mainloop()
3.在实例中使用库(Using a library in an example)
import tkinter as tk
from bubble import BubbleBox
root = tk.Tk()
BubbleBox(window, title="标题(title)", text="消息内容(Message content)", color="#0088FF", height=50)
BubbleBox.enqueue_bubble(window, title="标题(title)", text="消息内容(Message content)", color="#0088FF", height=50)
root.mainloop()
下面这些参数可以控制字体的大小、样式和使用的字体
The following parameters can control the font size, style, and the font used.
title_font:标题字体,字符串
title_size:标题大小,整数型
title_style:标题样式,字符串
text_font:消息内容字体,字符串
text_size:消息内容字体大小,整数型
text_style:消息样式,字符串
title_font: Title font, string
title_size: Title size, integer
title_style: Title style, string
text_font: Message content font, string
text_size: Message content font size, integer
text_style: Message style, string
BubbleBox(window, title="标题(title)", text="消息内容(Message content)", color="#0088FF", height=50)
BubbleBox.enqueue_bubble(window, title="标题(title)", text="消息内容(Message content)", color="#0088FF", height=50)
1.加入队列使用在BubbleBox后面添加.enqueue_bubble,以将气泡窗添加到队列
- To join the queue, use .enqueue_bubble after BubbleBox to add a bubble window to the queue.
2.第一个属性值是窗口实例的名称,比如创建了实例root = tk.TK,那么第一个属性要和实例名称重合,比如在这个例子里就是BubbleBox.enqueue_bubble(root, title="标题(title)", text="消息内容(Message content)", color="#0088FF", height=50)`
- The first attribute value is the name of the window instance. For example, if you create an instance with
root = tk.TK, then the first attribute should match the instance name. In this example, it would beBubbleBox.enqueue_bubble(root, title="Title (title)", text="Message content", color="#0088FF", height=50)