Python win32api.MessageBox() Examples
The following are 11
code examples of win32api.MessageBox().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32api
, or try the search function
.
Example #1
Source File: msgbox.py From eavatar-me with Apache License 2.0 | 7 votes |
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
Example #2
Source File: NextID.py From ConTroll_Remote_Access_Trojan with Apache License 2.0 | 6 votes |
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")
Example #3
Source File: desktopmanager.py From ironpython2 with Apache License 2.0 | 5 votes |
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()
Example #4
Source File: localserver.py From ironpython2 with Apache License 2.0 | 5 votes |
def main(): if len(sys.argv)==1: win32api.MessageBox(0, usage, "Python COM Server") sys.exit(1) serve(sys.argv[1:])
Example #5
Source File: popup_pywin_notifier.py From kimsufi-crawler with MIT License | 5 votes |
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)
Example #6
Source File: ipython.py From pyxll-examples with The Unlicense | 5 votes |
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)
Example #7
Source File: ipython.py From pyxll-examples with The Unlicense | 5 votes |
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)
Example #8
Source File: ipython.py From pyxll-examples with The Unlicense | 5 votes |
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)
Example #9
Source File: msgbox.py From eavatar-me with Apache License 2.0 | 5 votes |
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)
Example #10
Source File: msgbox.py From eavatar-me with Apache License 2.0 | 5 votes |
def alert(title, message, wnd=None): """ Make a warning. :param title: :param message: """ win32api.MessageBox(wnd, message, title, win32con.MB_OK | win32con.MB_ICONWARNING)
Example #11
Source File: msgbox.py From eavatar-me with Apache License 2.0 | 5 votes |
def error(title, message, wnd=None): """ Show error message. :param title: :param message: """ win32api.MessageBox(wnd, message, title, win32con.MB_OK | win32con.MB_ICONERROR)