Python tkinter.messagebox 模块,askquestion() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用tkinter.messagebox.askquestion()

项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
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?")
项目:SceneDensity    作者:ImOmid    | 项目源码 | 文件源码
def questionBox(self, title, message):
        self.topLevel.update_idletasks()
        return MessageBox.askquestion(title, message)
项目:Cryptokey_Generator    作者:8BitCookie    | 项目源码 | 文件源码
def questionBox(self, title, message):
        self.topLevel.update_idletasks()
        return MessageBox.askquestion(title, message)
项目:SPGL    作者:wynand1004    | 项目源码 | 文件源码
def ask_question(self, title, message):
        return messagebox.askquestion(title, message)
项目:SPGL    作者:wynand1004    | 项目源码 | 文件源码
def ask_question(self, title, message):
        return messagebox.askquestion(title, message)
项目:GUI_programming    作者:duolaAOA    | 项目源码 | 文件源码
def hit_me():
    #tk.messagebox.showinfo(title='Hi',message='hahaha')?????????????
    #?????????
    # msgbox.showinfo(title='Hi',message='hahaha')
    #?????????
    msgbox.showwarning(title='Hi',message='Fuck!')
    #?????????
    msgbox.showerror(title='Hi',message='ERROR!!')
    #???????,????YES?NO
    msgbox.askquestion(title='Hi',message='ERROR!!')
项目:BeachedWhale    作者:southpaw5271    | 项目源码 | 文件源码
def questionBox(self, title, message):
        self.topLevel.update_idletasks()
        return MessageBox.askquestion(title, message)
项目:restclientgui    作者:profullstack    | 项目源码 | 文件源码
def onQuest(self,message):
        messagebox.askquestion("Question", message)
项目:WinGuake    作者:chand1012    | 项目源码 | 文件源码
def ask_reset():
    result = messagebox.askquestion("Reset Settings", "Are You Sure?", icon='warning')
    print(result)
    if 'yes' in result:
        default_settings()
项目:stash-scanner    作者:senuido    | 项目源码 | 文件源码
def check_version_callback(self, latest):
        if not isinstance(latest, VersionInfo):
            return

        if latest.is_newer_than(self.VERSION_NUMBER):
            answer = messagebox.askquestion('Update', 'A newer version is available, would you like to download it?', parent=self)
            if answer == messagebox.YES:
                webbrowser.open(self.RELEASES_URL)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def main():
    top = tix.Tk()

    nb = tix.NoteBook(top, width=300, height=200)
    nb.pack(expand=True, fill="both")

    nb.add("page1", label="text")
    f1 = tix.Frame(nb.subwidget("page1"))
    st = tix.ScrolledText(f1)
    st.subwidget("text").insert("1.0", "Here is where the text goes...")
    st.pack(expand=True)
    f1.pack()

    nb.add("page2", label="Message Boxes")
    f2 = tix.Frame(nb.subwidget("page2"))
    # ??????expand,fill?anchor???????????????????????
    tix.Button(f2, text="error", bg="lightblue", command=lambda t="error", m="This is bad!": mb.showerror(t, m)).pack(fill="x",
                                                                                                                      expand=True)
    tix.Button(f2, text="info", bg="pink", command=lambda t="info", m="Information": mb.showinfo(t, m)).pack(fill="x", expand=True)
    tix.Button(f2, text="warning", bg="yellow", command=lambda t="warning", m="Don't do it!": mb.showwarning(t, m)).pack(fill="x",
                                                                                                                         expand=True)
    tix.Button(f2, text="question", bg="green", command=lambda t="question", m="Will I?": mb.askquestion(t, m)).pack(fill="x",
                                                                                                                     expand=True)
    tix.Button(f2, text="yes - no", bg="lightgrey", command=lambda t="yes - no", m="Are you sure?": mb.askyesno(t, m)).pack(
            fill="x", expand=True)
    tix.Button(f2, text="yes - no - cancel", bg="black", fg="white",
               command=lambda t="yes - not - cancel", m="Last chance...": mb.askyesnocancel(t, m)).pack(fill="x", expand=True)

    f2.pack(side="top", fill="x")
    top.mainloop()
项目:stash-scanner    作者:senuido    | 项目源码 | 文件源码
def update_configuration(self, cfg):
        if not isinstance(cfg, AppConfiguration):
            raise TypeError('cfg needs to be of type AppConfiguration')

        try:
            if config.league == cfg.league:
                config.update(cfg)
                config.save()
                self.nb_cfg.onTabChange()
                return

            answer = messagebox.askquestion('Settings',
                                            'Changing league will stop active scans and close other windows, continue?',
                                            parent=self)
            if answer == messagebox.NO:
                return

            self.close_editor_window()
            self.stop_scan()
            # if self.is_scan_active:
            #     self.stop_scan()
            #     ls = LoadingScreen(self)
            #     threading.Thread(target=self._stop_scan, args=(ls,)).start()
            #     self.wait_window(ls)

            try:
                StashScanner.clearLeagueData()
            except Exception as e:
                messagebox.showerror('Settings',
                                     'Failed to clear league data.\nError: {}\n'
                                     'Make sure all files are closed and try again.'.format(e),
                                     parent=self)
                return

            config.update(cfg)
            config.save()

            self.init_error = None
            ls = LoadingScreen(self)
            Thread(target=self.init_scanner, args=(ls,)).start()
            self.wait_window(ls)

            self.focus_set()
            self.lift()

            if self.init_error:
                title, message = self.init_error.args
                message += '\n{}'
                messagebox.showerror(title, message.format('Application will now close.'), parent=self)
                self.on_close()
                return

            self.init_warn()
            self.currency_info = CurrencyInfo()
            self.filters_info = FiltersInfo()

            self.nb_cfg.onTabChange()
        except Exception as e:
            logexception()
            logger.error('Unexpected error while attempting to change league.\n{}'.format(e))
            messagebox.showerror('Save error', 'Unexpected error while trying to save settings:\n{}'.format(e))