本文整理汇总了Python中tkMessageBox.askyesno方法的典型用法代码示例。如果您正苦于以下问题:Python tkMessageBox.askyesno方法的具体用法?Python tkMessageBox.askyesno怎么用?Python tkMessageBox.askyesno使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkMessageBox
的用法示例。
在下文中一共展示了tkMessageBox.askyesno方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clickQuit
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def clickQuit(self):
"""Quit & terminate the application. """
if self.__is_verbose: print "ACTION: Clicked 'Quit'"
# turn off toggle buttons
self.spaces_button.setOff()
self.cps_button.setOff()
response = True
# if the user hasn't recently saved, ask if they really wish to quit
if not self.__is_saved:
response = tkMessageBox.askyesno(
title = "Quit?",
message = "Are you sure you wish to quit?"
+ "All unsaved setup will be lost."
)
if response:
# user wishes to quit, destroy the application
self.quit()
self.master.destroy()
示例2: toggle_tabs_event
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def toggle_tabs_event(self, event):
if self.askyesno(
"Toggle tabs",
"Turn tabs " + ("on", "off")[self.usetabs] +
"?\nIndent width " +
("will be", "remains at")[self.usetabs] + " 8." +
"\n Note: a tab is always 8 columns",
parent=self.text):
self.usetabs = not self.usetabs
# Try to prevent inconsistent indentation.
# User must change indent width manually after using tabs.
self.indentwidth = 8
return "break"
# XXX this isn't bound to anything -- see tabwidth comments
## def change_tabwidth_event(self, event):
## new = self._asktabwidth()
## if new != self.tabwidth:
## self.tabwidth = new
## self.set_indentation_params(0, guess=0)
## return "break"
示例3: reload_from_disk
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def reload_from_disk(self, event = None):
# If we have opened a file, let's reload it from disk
# We'll dump the current undo stack, and load it fresh
if not self.current_plist:
# Nothing to do - ding and bail
self.bell()
return
# At this point - we should check if we have edited the file, and if so
# prompt the user
if self.edited:
self.bell()
if not mb.askyesno("Unsaved Changes","Any unsaved changes will be lost when reloading from disk. Continue?",parent=self):
return
# If we got here - we're okay with dumping changes (if any)
try:
with open(self.current_plist,"rb") as f:
plist_data = plist.load(f,dict_type=dict if self.controller.settings.get("sort_dict",False) else OrderedDict)
except Exception as e:
# Had an issue, throw up a display box
self.bell()
mb.showerror("An Error Occurred While Opening {}".format(os.path.basename(self.current_plist)), str(e),parent=self)
return
# We should have the plist data now
self.open_plist(self.current_plist,plist_data, self.plist_type_string.get())
示例4: new_db
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def new_db(self, filename=''):
"""create a new database"""
if filename == '':
filename = filedialog.asksaveasfilename(
initialdir=self.initialdir, defaultextension='.db',
title="Define a new database name and location",
filetypes=[("default", "*.db"), ("other", "*.db*"),
("all", "*.*")])
if filename != '':
self.database_file = filename
if os.path.isfile(filename):
self.set_initialdir(filename)
if messagebox.askyesno(
message='Confirm Destruction of previous Datas ?',
icon='question', title='Destroying'):
os.remove(filename)
self.conn = Baresql(self.database_file)
self.actualize_db()
示例5: popAsk
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def popAsk(text, title="Lackey Decision"):
""" Creates a yes-no dialog with the specified text. """
root = tk.Tk()
root.withdraw()
return tkMessageBox.askyesno(title, text)
# Be aware this overwrites the Python input() command-line function.
示例6: _info_license
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def _info_license(self):
result = tkMessageBox.askyesno("声明", "1、本程序不收集或上传任何信息,所有\n网络活动均是与微信服务器进行\n\n"
+ "2、为防止程序被恶意篡改,请确保程序\n是从“猿湿Xoong”渠道获取\n\n"
+ "3、将程序的MD5与公众号后台或github\n中MD5对比,即可判断是否被恶意篡改\n\n"
+ "4、本软件开源免费,请在遵守中国相关\n法律法规与微信使用规范的前提下使用,\n请勿用于非法用途,如产生法律纠纷与开\n发者无关\n"
+ "\n点击「是(Y)」继续,代表你同意此声明",
)
print result
if result == True:
self.on_click()
示例7: DeleteCustomKeys
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def DeleteCustomKeys(self):
keySetName=self.customKeys.get()
if not tkMessageBox.askyesno('Delete Key Set','Are you sure you wish '+
'to delete the key set %r ?' % (keySetName),
parent=self):
return
#remove key set from config
idleConf.userCfg['keys'].remove_section(keySetName)
if keySetName in self.changedItems['keys']:
del(self.changedItems['keys'][keySetName])
#write changes
idleConf.userCfg['keys'].Save()
#reload user key set list
itemList=idleConf.GetSectionList('user','keys')
itemList.sort()
if not itemList:
self.radioKeysCustom.config(state=DISABLED)
self.optMenuKeysCustom.SetMenu(itemList,'- no custom keys -')
else:
self.optMenuKeysCustom.SetMenu(itemList,itemList[0])
#revert to default key set
self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys','default'))
self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys','name'))
#user can't back out of these changes, they must be applied now
self.Apply()
self.SetKeysType()
示例8: DeleteCustomTheme
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def DeleteCustomTheme(self):
themeName=self.customTheme.get()
if not tkMessageBox.askyesno('Delete Theme','Are you sure you wish '+
'to delete the theme %r ?' % (themeName,),
parent=self):
return
#remove theme from config
idleConf.userCfg['highlight'].remove_section(themeName)
if themeName in self.changedItems['highlight']:
del(self.changedItems['highlight'][themeName])
#write changes
idleConf.userCfg['highlight'].Save()
#reload user theme list
itemList=idleConf.GetSectionList('user','highlight')
itemList.sort()
if not itemList:
self.radioThemeCustom.config(state=DISABLED)
self.optMenuThemeCustom.SetMenu(itemList,'- no custom themes -')
else:
self.optMenuThemeCustom.SetMenu(itemList,itemList[0])
#revert to default theme
self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme','default'))
self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme','name'))
#user can't back out of these changes, they must be applied now
self.Apply()
self.SetThemeType()
示例9: DeleteCustomKeys
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def DeleteCustomKeys(self):
keySetName=self.customKeys.get()
delmsg = 'Are you sure you wish to delete the key set %r ?'
if not tkMessageBox.askyesno(
'Delete Key Set', delmsg % keySetName, parent=self):
return
#remove key set from config
idleConf.userCfg['keys'].remove_section(keySetName)
if keySetName in self.changedItems['keys']:
del(self.changedItems['keys'][keySetName])
#write changes
idleConf.userCfg['keys'].Save()
#reload user key set list
itemList = idleConf.GetSectionList('user', 'keys')
itemList.sort()
if not itemList:
self.radioKeysCustom.config(state=DISABLED)
self.optMenuKeysCustom.SetMenu(itemList, '- no custom keys -')
else:
self.optMenuKeysCustom.SetMenu(itemList, itemList[0])
#revert to default key set
self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys', 'default'))
self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys', 'name'))
#user can't back out of these changes, they must be applied now
self.Apply()
self.SetKeysType()
示例10: DeleteCustomTheme
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def DeleteCustomTheme(self):
themeName = self.customTheme.get()
delmsg = 'Are you sure you wish to delete the theme %r ?'
if not tkMessageBox.askyesno(
'Delete Theme', delmsg % themeName, parent=self):
return
#remove theme from config
idleConf.userCfg['highlight'].remove_section(themeName)
if themeName in self.changedItems['highlight']:
del(self.changedItems['highlight'][themeName])
#write changes
idleConf.userCfg['highlight'].Save()
#reload user theme list
itemList = idleConf.GetSectionList('user', 'highlight')
itemList.sort()
if not itemList:
self.radioThemeCustom.config(state=DISABLED)
self.optMenuThemeCustom.SetMenu(itemList, '- no custom themes -')
else:
self.optMenuThemeCustom.SetMenu(itemList, itemList[0])
#revert to default theme
self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme', 'default'))
self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme', 'name'))
#user can't back out of these changes, they must be applied now
self.Apply()
self.SetThemeType()
示例11: close_window
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def close_window(self):
yes = tkmessage.askyesno("Exit", "Do you really want to quit?")
if yes:
self.close()
示例12: storeCheckInComment
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def storeCheckInComment(caseIds, version, comment):
# In real life, this fuction would use ODBC, COM etc, not a dialog!
title = 'Store info in issue database'
message = ('Hello, can you store in the issue database\n'
'that we got the following message:\n%s\n'
'when we checked in\n%s\n\n%s') % (" & ".join(caseIds),
version, comment)
if tkMessageBox.askyesno(title, message):
# Reply was yes
return 0
else:
# Reply was no
return 1
示例13: update_mln
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def update_mln(self, old=None, new=None, content=None, askoverwrite=True):
if old is None:
old = self.mln_container.selected_file.get()
if new is None:
new = self.mln_container.selected_file.get().strip('*')
if content is None:
content = self.mln_container.editor.get("1.0", END).strip()
if old == new and askoverwrite:
savechanges = tkMessageBox.askyesno("Save changes",
"A file '{}' already exists. "
"Overwrite?".format(new))
if savechanges:
self.project.mlns[old] = content
else:
logger.error('no name specified!')
return -1
elif old == new and not askoverwrite:
self.project.mlns[old] = content
else:
if new in self.project.mlns:
if askoverwrite:
savechanges = tkMessageBox.askyesno("Save changes", "A file '{}' already exists. Overwrite?".format(new))
if savechanges:
self.project.mlns[new] = content
else:
logger.error('no name specified!')
return -1
else:
self.project.mlns[new] = content
return 1
示例14: update_db
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def update_db(self, old=None, new=None, content=None, askoverwrite=True):
if old is None:
old = self.db_container.selected_file.get()
if new is None:
new = self.db_container.selected_file.get().strip('*')
if content is None:
content = self.db_container.editor.get("1.0", END).strip()
if old == new and askoverwrite:
savechanges = tkMessageBox.askyesno("Save changes", "A file '{}' already exists. Overwrite?".format(new))
if savechanges:
self.project.dbs[old] = content
else:
logger.error('no name specified!')
return -1
elif old == new and not askoverwrite:
self.project.dbs[old] = content
else:
if new in self.project.dbs:
if askoverwrite:
savechanges = tkMessageBox.askyesno("Save changes", "A file '{}' already exists. Overwrite?".format(new))
if savechanges:
self.project.dbs[new] = content
else:
logger.error('no name specified!')
return -1
else:
self.project.dbs[new] = content
return 1
示例15: update_mln
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askyesno [as 别名]
def update_mln(self, old=None, new=None, content=None, askoverwrite=True):
if old is None:
old = self.mln_container.selected_file.get()
if new is None:
new = self.mln_container.selected_file.get().strip('*')
if content is None:
content = self.mln_container.editor.get("1.0", END).strip()
if old == new and askoverwrite:
savechanges = tkMessageBox.askyesno("Save changes", "A file '{}' already exists. Overwrite?".format(new))
if savechanges:
self.project.mlns[old] = content
else:
logger.error('no name specified!')
return -1
elif old == new and not askoverwrite:
self.project.mlns[old] = content
else:
if new in self.project.mlns:
if askoverwrite:
savechanges = tkMessageBox.askyesno("Save changes", "A file '{}' already exists. Overwrite?".format(new))
if savechanges:
self.project.mlns[new] = content
else:
logger.error('no name specified!')
return -1
else:
self.project.mlns[new] = content
return 1