本文整理汇总了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