本文整理汇总了Python中win32api.MessageBox方法的典型用法代码示例。如果您正苦于以下问题:Python win32api.MessageBox方法的具体用法?Python win32api.MessageBox怎么用?Python win32api.MessageBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类win32api
的用法示例。
在下文中一共展示了win32api.MessageBox方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_desktop
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def create_desktop(desktop_name, start_explorer=1):
""" Creates a new desktop and spawns a thread running on it
Will also start a new icon thread on an existing desktop
"""
sa=pywintypes.SECURITY_ATTRIBUTES()
sa.bInheritHandle=1
try:
hdesk=win32service.CreateDesktop(desktop_name, 0, win32con.MAXIMUM_ALLOWED, sa)
except win32service.error:
traceback.print_exc()
errbuf=cStringIO.StringIO()
traceback.print_exc(None,errbuf)
win32api.MessageBox(0, errbuf.getvalue(), 'Desktop creation failed')
return
if start_explorer:
s=win32process.STARTUPINFO()
s.lpDesktop=desktop_name
prc_info=win32process.CreateProcess(None, "Explorer.exe",None,None,True,win32con.CREATE_NEW_CONSOLE,None,'c:\\',s)
th=thread.start_new_thread(new_icon,(hdesk,desktop_name))
hdesk.SwitchDesktop()
示例2: __init__
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def __init__(self):
import win32api
win32api.MessageBox(0, "NextID.__init__ started", "NextID.py")
global d
if sys.frozen:
for entry in sys.path:
if entry.find('?') > -1:
here = os.path.dirname(entry.split('?')[0])
break
else:
here = os.getcwd()
else:
here = os.path.dirname(__file__)
self.fnm = os.path.join(here, 'id.cfg')
try:
d = eval(open(self.fnm, 'rU').read()+'\n')
except:
d = {
'systemID': 0xaaaab,
'highID': 0
}
win32api.MessageBox(0, "NextID.__init__ complete", "NextID.py")
示例3: main
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def main():
if len(sys.argv)==1:
win32api.MessageBox(0, usage, "Python COM Server")
sys.exit(1)
serve(sys.argv[1:])
示例4: notify
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def notify(self, title, text, url=False):
"""Open popup notification window with easygui"""
import win32api
# 0x00001000 -- Value represents MB_SYSTEMMODAL
# This is to allow for the messagebox to sit over every window
# Something that is not possible using easygui (as far as I'm aware)
if win32api.MessageBox(0, text, title, 0x00001000) == 1:
webbrowser.open_new_tab(url)
示例5: ipython_qtconsole
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def ipython_qtconsole(*args):
"""
Launches an IPython Qt console
"""
try:
# start the IPython kernel
app = _start_kernel()
# start a subprocess to run the Qt console
# run jupyter in it's own process
_launch_qt_console(app.connection_file)
except:
if win32api:
win32api.MessageBox(None, "Error starting IPython Qt console")
_log.error("Error starting IPython Qt console", exc_info=True)
示例6: set_selection_in_ipython
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def set_selection_in_ipython(*args):
"""
Gets the value of the selected cell and copies it to
the globals dict in the IPython kernel.
"""
try:
if not getattr(sys, "_ipython_app", None) or not sys._ipython_kernel_running:
raise Exception("IPython kernel not running")
xl = xl_app(com_package="win32com")
selection = xl.Selection
if not selection:
raise Exception("Nothing selected")
value = selection.Value
# convert any cached objects (PyXLL >= 4 only)
pyxll_version = int(pyxll.__version__.split(".")[0])
if pyxll_version >= 4 and isinstance(value, str):
try:
to_object = get_type_converter("var", "object")
value = to_object(value)
except KeyError:
pass
# set the value in the shell's locals
sys._ipython_app.shell.user_ns["_"] = value
print("\n\n>>> Selected value set as _")
except:
if win32api:
win32api.MessageBox(None, "Error setting selection in Excel")
_log.error("Error setting selection in Excel", exc_info=True)
示例7: inform
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def inform(title, message, wnd=None):
""" Display information to user.
:param title:
:param message:
"""
win32api.MessageBox(wnd, message, title,
win32con.MB_OK | win32con.MB_ICONINFORMATION)
示例8: confirm
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def confirm(title, message, wnd=None):
""" Confirm with the user.
:param title: The message title
:param message: the message body
:return: True if user agreed; False, otherwise.
"""
answer = win32api.MessageBox(wnd, message, title,
win32con.MB_YESNO | win32con.MB_ICONQUESTION)
return answer == win32con.IDYES
示例9: alert
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def alert(title, message, wnd=None):
""" Make a warning.
:param title:
:param message:
"""
win32api.MessageBox(wnd, message, title,
win32con.MB_OK | win32con.MB_ICONWARNING)
示例10: error
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import MessageBox [as 别名]
def error(title, message, wnd=None):
""" Show error message.
:param title:
:param message:
"""
win32api.MessageBox(wnd, message, title,
win32con.MB_OK | win32con.MB_ICONERROR)