本文整理匯總了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