本文整理匯總了Python中tkMessageBox.askyesnocancel方法的典型用法代碼示例。如果您正苦於以下問題:Python tkMessageBox.askyesnocancel方法的具體用法?Python tkMessageBox.askyesnocancel怎麽用?Python tkMessageBox.askyesnocancel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tkMessageBox
的用法示例。
在下文中一共展示了tkMessageBox.askyesnocancel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: maybesave
# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askyesnocancel [as 別名]
def maybesave(self):
if self.get_saved():
return "yes"
message = "Do you want to save %s before closing?" % (
self.filename or "this untitled document")
confirm = tkMessageBox.askyesnocancel(
title="Save On Close",
message=message,
default=tkMessageBox.YES,
master=self.text)
if confirm:
reply = "yes"
self.save(None)
if not self.get_saved():
reply = "cancel"
elif confirm is None:
reply = "cancel"
else:
reply = "no"
self.text.focus_set()
return reply
示例2: maybesave
# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askyesnocancel [as 別名]
def maybesave(self):
if self.get_saved():
return "yes"
message = "Do you want to save %s before closing?" % (
self.filename or "this untitled document")
confirm = tkMessageBox.askyesnocancel(
title="Save On Close",
message=message,
default=tkMessageBox.YES,
parent=self.text)
if confirm:
reply = "yes"
self.save(None)
if not self.get_saved():
reply = "cancel"
elif confirm is None:
reply = "cancel"
else:
reply = "no"
self.text.focus_set()
return reply
示例3: quit
# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askyesnocancel [as 別名]
def quit(self):
if self.settings_dirty.get() or self.project_dirty.get():
savechanges = tkMessageBox.askyesnocancel("Save changes", "You have unsaved project changes. Do you want to save them before quitting?")
if savechanges is None:
return
elif savechanges:
self.noask_save_project()
self.master.destroy()
else:
# write gui settings and destroy
self.write_gconfig()
self.master.destroy()
####################### PROJECT FUNCTIONS #################################
示例4: check_save
# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askyesnocancel [as 別名]
def check_save(self):
if not self.edited:
return True # No changes, all good
# Post a dialog asking if we want to save the current plist
answer = mb.askyesnocancel("Unsaved Changes", "Save changes to {}?".format(self.get_title()))
if answer == True:
return self.save_plist()
return answer