Skip to content

Instantly share code, notes, and snippets.

Last active February 17, 2023 09:21
What would you like to do?
import ctypes
def main():
WS_EX_TOPMOST = 0x40000
windowTitle = "Python Windows Message Box Test"
message = "Hello, world! This Message box was created by calling the Windows API using the ctypes library."
# display a message box; execution will stop here until user acknowledges
ctypes.windll.user32.MessageBoxExW(None, message, windowTitle, WS_EX_TOPMOST)
print("User clicked OK.")
if __name__ == "__main__":
Copy link

This sample Python script will display a Windows API message box:

Copy link

hosamn commented Nov 18, 2022

Nice find 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment