def addnewunit(title, text, style):
ctypes.windll.user32.MessageBoxW(0, text, title, style)
Ive seen a lot of people show this code, however no
Other answers show that the return value indicates what button is pressed, but if you don't want to look up all the constant values use pywin32, which has already wrapped much of the Windows API for you (Demo in Chinese to show it is calling Unicode API):
#coding:utf8
import win32api
import win32con
result = win32api.MessageBox(None,'你是美国人吗?','问题',win32con.MB_YESNO)
if result == win32con.IDYES:
print('是')
else:
print('不是')