My question is similar to this question, but I'm using Xubuntu, so the win32 api is obviously not available. Is there some alternative I can use?
I just need to have a simple window pop up with a message, from a python script.
The warn() function defined in the ' warning ' module is used to show warning messages. The warning module is actually a subclass of Exception which is a built-in class in Python.
The tkMessageBox module is used to display message boxes in your applications. This module provides a number of functions that you can use to display an appropriate message. Some of these functions are showinfo, showwarning, showerror, askquestion, askokcancel, askyesno, and askretryignore.
To create a notification rather than a dialog box that needs to be dismissed, you can use notify-send
as shown below. This also does not require installing python-tk
or other packages.
import subprocess
subprocess.run(["/usr/bin/notify-send", "--icon=error", "This is your error message ..."])
See the man page for more options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With