本文整理汇总了Python中win32ui.MessageBox方法的典型用法代码示例。如果您正苦于以下问题:Python win32ui.MessageBox方法的具体用法?Python win32ui.MessageBox怎么用?Python win32ui.MessageBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类win32ui
的用法示例。
在下文中一共展示了win32ui.MessageBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LoadConfiguration
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def LoadConfiguration():
global configManager
# Bit of a hack I dont kow what to do about?
from config import ConfigManager
configName = rc = win32ui.GetProfileVal("Editor", "Keyboard Config", "default")
configManager = ConfigManager(configName)
if configManager.last_error:
bTryDefault = 0
msg = "Error loading configuration '%s'\n\n%s" % (configName, configManager.last_error)
if configName != "default":
msg = msg + "\n\nThe default configuration will be loaded."
bTryDefault = 1
win32ui.MessageBox(msg)
if bTryDefault:
configManager = ConfigManager("default")
if configManager.last_error:
win32ui.MessageBox("Error loading configuration 'default'\n\n%s" % (configManager.last_error))
示例2: OnOpenDocument
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def OnOpenDocument(self, filename):
# init data members
#print "Opening", filename
self.SetPathName(filename) # Must set this early!
try:
# load the text as binary we can get smart
# about detecting any existing EOL conventions.
f = open(filename, 'rb')
try:
self._LoadTextFromFile(f)
finally:
f.close()
except IOError:
win32ui.MessageBox("Could not load the file from %s" % filename)
return 0
return 1
示例3: OnHelp
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def OnHelp(self,id, code):
try:
if id==win32ui.ID_HELP_GUI_REF:
helpFile = regutil.GetRegisteredHelpFile("Pythonwin Reference")
helpCmd = win32con.HELP_CONTENTS
else:
helpFile = regutil.GetRegisteredHelpFile("Main Python Documentation")
helpCmd = win32con.HELP_FINDER
if helpFile is None:
win32ui.MessageBox("The help file is not registered!")
else:
import help
help.OpenHelpFile(helpFile, helpCmd)
except:
t, v, tb = sys.exc_info()
win32ui.MessageBox("Internal error in help file processing\r\n%s: %s" % (t,v))
tb = None # Prevent a cycle
示例4: OnViewBrowse
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def OnViewBrowse( self, id, code ):
" Called when ViewBrowse message is received "
from pywin.mfc import dialog
from pywin.tools import browser
obName = dialog.GetSimpleInput('Object', '__builtins__', 'Browse Python Object')
if obName is None:
return
try:
browser.Browse(eval(obName, __main__.__dict__, __main__.__dict__))
except NameError:
win32ui.MessageBox('This is no object with this name')
except AttributeError:
win32ui.MessageBox('The object has no attribute of that name')
except:
traceback.print_exc()
win32ui.MessageBox('This object can not be browsed')
示例5: OnFileLocate
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def OnFileLocate( self, id, code ):
from pywin.mfc import dialog
import scriptutils
import os
global lastLocateFileName # save the new version away for next time...
name = dialog.GetSimpleInput('File name', lastLocateFileName, 'Locate Python File')
if name is None: # Cancelled.
return
lastLocateFileName = name
# if ".py" supplied, rip it off!
# should also check for .pys and .pyw
if lastLocateFileName[-3:].lower()=='.py':
lastLocateFileName = lastLocateFileName[:-3]
lastLocateFileName = lastLocateFileName.replace(".","\\")
newName = scriptutils.LocatePythonFile(lastLocateFileName)
if newName is None:
win32ui.MessageBox("The file '%s' can not be located" % lastLocateFileName)
else:
win32ui.GetApp().OpenDocumentFile(newName)
# Display all the "options" proprety pages we can find
示例6: msgbox
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def msgbox(self, *args):
msg = ''.join(map(str, args))
win32ui.MessageBox(msg)
示例7: NotAScript
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def NotAScript():
import win32ui
win32ui.MessageBox(NotScriptMsg, "Demos")
示例8: NeedGoodGUI
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def NeedGoodGUI():
from pywin.framework.app import HaveGoodGUI
rc = HaveGoodGUI()
if not rc:
win32ui.MessageBox(NeedGUIMsg, "Demos")
return rc
示例9: NeedApp
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def NeedApp():
import win32ui
rc = win32ui.MessageBox(NeedAppMsg % sys.argv[0], "Demos", win32con.MB_YESNO)
if rc==win32con.IDYES:
try:
parent = win32ui.GetMainFrame().GetSafeHwnd()
win32api.ShellExecute(parent, None, 'pythonwin.exe', '/app "%s"' % sys.argv[0], None, 1)
except win32api.error, details:
win32ui.MessageBox("Error executing command - %s" % (details), "Demos")
示例10: GetIDLEModule
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def GetIDLEModule(module):
try:
# First get it from Pythonwin it is exists.
modname = "pywin.idle." + module
__import__(modname)
except ImportError, details:
msg = "The IDLE extension '%s' can not be located.\r\n\r\n" \
"Please correct the installation and restart the" \
" application.\r\n\r\n%s" % (module, details)
win32ui.MessageBox(msg)
return None
示例11: askyesno
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def askyesno(self, caption, prompt, parent=None):
return win32ui.MessageBox(prompt, caption, win32con.MB_YESNO)==win32con.IDYES
######################################################################
# The IDLE "Virtual Text Widget" methods that are exposed to the IDLE extensions.
#
# Is character at text_index in a Python string? Return 0 for
# "guaranteed no", true for anything else.
示例12: DoConfigChange
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def DoConfigChange(self):
# Bit of a hack I dont kow what to do about - these should be "editor options"
from pywin.framework.editor import GetEditorOption
self.bAutoCompleteAttributes = GetEditorOption("Autocomplete Attributes", 1)
self.bShowCallTips = GetEditorOption("Show Call Tips", 1)
# Update the key map and extension data.
configManager.configure(self, self._GetSubConfigNames())
if configManager.last_error:
win32ui.MessageBox(configManager.last_error, "Configuration Error")
self.bMatchBraces = GetEditorOption("Match Braces", 1)
self.ApplyFormattingStyles(1)
示例13: TakeDefaultAction
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def TakeDefaultAction(self, item):
win32ui.MessageBox('Got item ' + self.GetText(item))
##########################################################################
#
# Classes for use with seperate HierListItems.
#
#
示例14: OnDeleteKey
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def OnDeleteKey(self,command, code):
hitem = self.hierList.GetSelectedItem()
item = self.hierList.ItemFromHandle(hitem)
msg = "Are you sure you wish to delete the key '%s'?" % (item.keyName,)
id = win32ui.MessageBox(msg, None, win32con.MB_YESNO)
if id != win32con.IDYES:
return
if SafeApply(win32api.RegDeleteKey, (item.keyRoot, item.keyName), "deleting registry key" ):
# Get the items parent.
try:
hparent = self.GetParentItem(hitem)
except win32ui.error:
hparent = None
self.hierList.Refresh(hparent)
示例15: EditValue
# 需要导入模块: import win32ui [as 别名]
# 或者: from win32ui import MessageBox [as 别名]
def EditValue(self, item):
# Edit the current value
class EditDialog(dialog.Dialog):
def __init__(self, item):
self.item = item
dialog.Dialog.__init__(self, win32ui.IDD_LARGE_EDIT)
def OnInitDialog(self):
self.SetWindowText("Enter new value")
self.GetDlgItem(win32con.IDCANCEL).ShowWindow(win32con.SW_SHOW)
self.edit = self.GetDlgItem(win32ui.IDC_EDIT1)
# Modify the edit windows style
style = win32api.GetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE)
style = style & (~win32con.ES_WANTRETURN)
win32api.SetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE, style)
self.edit.SetWindowText(str(self.item))
self.edit.SetSel(-1)
return dialog.Dialog.OnInitDialog(self)
def OnDestroy(self,msg):
self.newvalue = self.edit.GetWindowText()
try:
index = self.GetNextItem(-1, commctrl.LVNI_SELECTED)
except win32ui.error:
return # No item selected.
if index==0:
keyVal = ""
else:
keyVal = self.GetItemText(index,0)
# Query for a new value.
try:
newVal = self.GetItemsCurrentValue(item, keyVal)
except TypeError, details:
win32ui.MessageBox(details)
return