本文整理汇总了Python中tkMessageBox.askokcancel方法的典型用法代码示例。如果您正苦于以下问题:Python tkMessageBox.askokcancel方法的具体用法?Python tkMessageBox.askokcancel怎么用?Python tkMessageBox.askokcancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkMessageBox
的用法示例。
在下文中一共展示了tkMessageBox.askokcancel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format_confirm
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def format_confirm(self):
sd = self.disk_choice.get()
sd = tuple([x for x in sd[1:-1].split("'")]) #super ugly way to make string into tuple
sd = sd[1]
message = "Formatting %s will permanently erase all data and partitions on %s. \nPlease confirm that you have chosen the correct disk to format. \n \nFormatting can take several minutes to complete, please be patient." % (sd, sd)
self.window.grab_release()
self.window.wm_attributes("-topmost", 0)
confirm = tkMessageBox.askokcancel("Confirm Format", message)
self.window.wm_attributes("-topmost", 1)
self.window.grab_set()
if confirm == True:
self.format_disk(sd)
else:
return
示例2: validate_file_path
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def validate_file_path(self):
if len(self.filePath.get()) < 1:
path = tkFileDialog.asksaveasfilename(parent=self.master,defaultextension=".xml", initialfile="%s.xml" % self.getInitialFileName(), title="Save New Config", initialdir=self.getInitialFolder())
self.filePath.set(path)
if len(self.filePath.get()) < 1:
tkMessageBox.showwarning(
"File path not specified",
"A file save path has not been specified, please try again or hit cancel to exit without saving.")
return 0
if self.originalPath != None and self.filePath.get() != self.originalPath and os.path.isfile(self.filePath.get()):
result = tkMessageBox.askokcancel(
"File Overwrite Confirmation",
"Specified file path already exists, do you wish to overwrite?")
if not result: return 0
return 1
示例3: ask_save_dialog
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def ask_save_dialog(self):
msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?"
confirm = tkMessageBox.askokcancel(title="Save Before Run or Check",
message=msg,
default=tkMessageBox.OK,
master=self.editwin.text)
return confirm
示例4: close
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def close(self):
"Extend EditorWindow.close()"
if self.executing:
response = tkMessageBox.askokcancel(
"Kill?",
"The program is still running!\n Do you want to kill it?",
default="ok",
parent=self.text)
if response is False:
return "cancel"
self.stop_readline()
self.canceled = True
self.closing = True
# Wait for poll_subprocess() rescheduling to stop
self.text.after(2 * self.pollinterval, self.close2)
示例5: close
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def close(self):
"Extend EditorWindow.close()"
if self.executing:
response = tkMessageBox.askokcancel(
"Kill?",
"The program is still running!\n Do you want to kill it?",
default="ok",
parent=self.text)
if response is False:
return "cancel"
self.stop_readline()
self.canceled = True
self.closing = True
return EditorWindow.close(self)
示例6: askclose
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def askclose():
if tkMessageBox.askokcancel("Quit", "Do you really wish to exit?"):
root.destroy()
示例7: ask_save_dialog
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def ask_save_dialog(self):
msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?"
confirm = tkMessageBox.askokcancel(title="Save Before Run or Check",
message=msg,
default=tkMessageBox.OK,
parent=self.editwin.text)
return confirm
示例8: close
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def close(self):
"Extend EditorWindow.close()"
if self.executing:
response = tkMessageBox.askokcancel(
"Kill?",
"Your program is still running!\n Do you want to kill it?",
default="ok",
parent=self.text)
if response is False:
return "cancel"
self.stop_readline()
self.canceled = True
self.closing = True
return EditorWindow.close(self)
示例9: ask_ok_cancel
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def ask_ok_cancel(self, title, message):
return messagebox.askokcancel(title, message)
示例10: exit_command
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def exit_command(root):
if tkMessageBox.askokcancel("Quit", "Do you really want to quit?"):
root.destroy()
示例11: handler
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def handler(self):
"""Handler on explicitly closing the GUI window."""
self.pauseMovie()
if tkMessageBox.askokcancel("Quit?", "Are you sure you want to quit?"):
self.exitClient()
else: # When the user presses cancel, resume playing.
#self.playMovie()
print "Playing Movie"
threading.Thread(target=self.listenRtp).start()
#self.playEvent = threading.Event()
#self.playEvent.clear()
self.sendRtspRequest(self.PLAY)
示例12: exit_app
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def exit_app(self):
if tkMessageBox.askokcancel("Quit", "Do you really want to quit?"):
self.root.destroy()
#basic UI
示例13: exit_editor
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def exit_editor():
if tkMessageBox.askokcancel("Quti", "Do you really want to quit?"):
root.destroy()
示例14: close_player
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def close_player(self):
if tkMessageBox.askokcancel("Quit", "Do you really want to close quit?"):
try:
self.player.pause()
except:
pass
self.root.destroy()
示例15: print_window
# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import askokcancel [as 别名]
def print_window(self, event):
confirm = tkMessageBox.askokcancel(
title="Print",
message="Print to Default Printer",
default=tkMessageBox.OK,
master=self.text)
if not confirm:
self.text.focus_set()
return "break"
tempfilename = None
saved = self.get_saved()
if saved:
filename = self.filename
# shell undo is reset after every prompt, looks saved, probably isn't
if not saved or filename is None:
(tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_')
filename = tempfilename
os.close(tfd)
if not self.writefile(tempfilename):
os.unlink(tempfilename)
return "break"
platform = os.name
printPlatform = True
if platform == 'posix': #posix platform
command = idleConf.GetOption('main','General',
'print-command-posix')
command = command + " 2>&1"
elif platform == 'nt': #win32 platform
command = idleConf.GetOption('main','General','print-command-win')
else: #no printing for this platform
printPlatform = False
if printPlatform: #we can try to print for this platform
command = command % pipes.quote(filename)
pipe = os.popen(command, "r")
# things can get ugly on NT if there is no printer available.
output = pipe.read().strip()
status = pipe.close()
if status:
output = "Printing failed (exit status 0x%x)\n" % \
status + output
if output:
output = "Printing command: %s\n" % repr(command) + output
tkMessageBox.showerror("Print status", output, master=self.text)
else: #no printing for this platform
message = "Printing is not enabled for this platform: %s" % platform
tkMessageBox.showinfo("Print status", message, master=self.text)
if tempfilename:
os.unlink(tempfilename)
return "break"