我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用tkinter.messagebox.askretrycancel()。
def main(): # ?????????,?????Tkinter????????Tk??.??????withdraw()?????? tk = tkinter.Tk() tk.withdraw() # ????? print(dir(mb)) # ??,?????????,??ok,????????????.??????????????,??????????. # ??,???Cancel?,??????None mb.showinfo("Title", "Your message here") mb.showerror("An Error", "Oops!") mb.showwarning("Title", "This may not work...") mb.askyesno("Title", "Do you love me?") mb.askokcancel("Title", "Are you well?") mb.askquestion("Title", "How are you?") mb.askretrycancel("Title", "Go again?") mb.askyesnocancel("Title", "Are you well?")
def retryBox(self, title, message): self.topLevel.update_idletasks() return MessageBox.askretrycancel(title, message)
def __init__(self, response=str, text="", title=None, accept=0, **options): if response is bool: self.dialog = [askyesno, askokcancel, askretrycancel][accept] else: self.dialog = {None:showinfo, str:askstring, int:askinteger, float:askfloat, 0:askopenfilename, 1:asksaveasfilename, 2:askdirectory}[response] self.options = options.copy() if "initialdir" in options: self.options["initialdir"] = abspath(options["initialdir"]) if type(response) is int: self.args = tuple() if title: self.options["title"] = title else: if title is None: title = "Info" if response is None else "Confirm" if response is bool else "Input" self.args = title, text
def ask_retry_cancel(self, title, message): return messagebox.askretrycancel(title, message)