You could use an import and single line code like this:
import ctypes # An included library with Python install.
[Link](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):
[Link](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 | No
## 6 : Cancel | Try Again | Continue
Have fun!
Simple VBA like MessageBox in Python
Some days ago I found a very easy pythonic way to show a VBA-like MessageBox. It was created with only one line of
cpython code.
The code is very very easy. Simply change the last integer parameter to change the style of the message box.
import ctypes
msgbox = [Link]
ret = msgbox(None, 'Press OK to end the demo.', 'Deviare Python Demo', 0)
print ret
The last parameter controls the style of the MessageBox. There are 7 styles: