How can I create a simple message box in Python?
Have you looked at easygui?
import easygui
easygui.msgbox("This is a message!", title="simple gui")
You could use an import and single line code like this:
import ctypes # An included library with Python install.
ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 1)
Or define a function (Mbox) like so:
import ctypes # An included library with Python install.
def Mbox(title, text, style):
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
Mbox('Your title', 'Your text', 1)
Note the styles are as follows:
## Styles:
## 0 : OK
## 1 : OK | Cancel
## 2 : Abort | Retry | Ignore
## 3 : Yes | No | Cancel
## 4 : Yes | No
## 5 : Retry | Cancel
## 6 : Cancel | Try Again | Continue
Have fun!
Note: edited to use MessageBoxW
instead of MessageBoxA