python windows prompt
import win32api
import win32con
result = win32api.MessageBox(None,'Sometesxt','title',win32con.MB_YESNO)
if result == win32con.IDYES:
print('Yes')
else:
print('No')
import win32con
result = win32api.MessageBox(None,'Sometesxt','title',win32con.MB_YESNO)
if result == win32con.IDYES:
print('Yes')
else:
print('No')
import ctypes # An included library with Python install.
ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 1)
## 1 : OK | Cancel
Or define a function (Mbox) like so:
import ctypes # An included library with Python install.
def Mbox(title, text, style):
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 | No
## 6 : Cancel | Try Again | Continue
Kommentarer
Send en kommentar