如何使用桌面上的python程序(windows7)在桌面上显示一个简单的通知而不使用notify2、notifysend、pqt5?

2024-10-02 08:18:44 发布

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

我试过这三种方法,但都不管用。你知道吗

Notifiy send不是命令,我也没有linux或ubuntu。你知道吗

我不能在python中导入notify2,因为我得到一个错误,它说notify2库不能导入dbus,我试着pip3安装dbus,但是它不存在(什么??)。我无法安装自制软件来修复它。你知道吗

pqt5运行时没有编译错误,但没有显示任何通知。它在我的mac电脑上可以正常工作,但在我的windows pc上不行


Tags: 方法命令send软件ubuntulinuxwindowsmac
1条回答
网友
1楼 · 发布于 2024-10-02 08:18:44

您可以使用tkinter,它是tkgui工具箱的一个接口。你知道吗

在Python 3上:

import tkinter as tk
from tkinter import messagebox

root = tk.Tk()
root.withdraw() # This hides the main window of the gui
messagebox.showinfo("Pay attention", "Something happened!")

在Python 2上:

import Tkinter as tk
import tkMessageBox

root = tk.Tk()
root.withdraw() # This hides the main window of the gui
tkMessageBox.showinfo("Pay attention", "Something happened!")

这将创建一个简单的弹出式警报,并应在Windows上工作。你知道吗

相关问题 更多 >

    热门问题