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 = ctypes.windll.user32.MessageBoxA
ret = msgbox(None, 'Press OK to end the demo.', 'Deviare Python Demo', 0)
print ret

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.