import win32api
class MessageBox:
@staticmethod
def show(msg, title="Message", style=0):
win32api.MessageBox(0, msg, title, style)
@staticmethod
def show_info(msg, title="Information"):
win32api.MessageBox(0, msg, title, 0x40)
@staticmethod
def show_warning(msg, title="Warning"):
win32api.MessageBox(0, msg, title, 0x30)
@staticmethod
def show_error(msg, title="Error"):
win32api.MessageBox(0, msg, title, 0x10)
@staticmethod
def yes_no(msg, title="Question"):
return win32api.MessageBox(0, msg, title, 0x04) == 6
@staticmethod
def yes_no_cancel(msg, title="Question"):
return win32api.MessageBox(0, msg, title, 0x03) == 6
@staticmethod
def retry_cancel(msg, title="Question"):
return win32api.MessageBox(0, msg, title, 0x05) == 4
win32api 弹窗
于 2023-06-19 01:53:30 首次发布