當前位置: 首頁>>代碼示例>>Python>>正文


Python messagebox.askyesno方法代碼示例

本文整理匯總了Python中tkinter.messagebox.askyesno方法的典型用法代碼示例。如果您正苦於以下問題:Python messagebox.askyesno方法的具體用法?Python messagebox.askyesno怎麽用?Python messagebox.askyesno使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tkinter.messagebox的用法示例。


在下文中一共展示了messagebox.askyesno方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: find

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def find(self, text_to_find):
        length = tk.IntVar()
        idx = self.search(text_to_find, self.find_search_starting_index, stopindex=tk.END, count=length)

        if idx:
            self.tag_remove('find_match', 1.0, tk.END)

            end = f'{idx}+{length.get()}c'
            self.tag_add('find_match', idx, end)
            self.see(idx)

            self.find_search_starting_index = end
            self.find_match_index = idx
        else:
            if self.find_match_index != 1.0:
                if msg.askyesno("No more results", "No further matches. Repeat from the beginning?"):
                    self.find_search_starting_index = 1.0
                    self.find_match_index = None
                    return self.find(text_to_find)
            else:
                msg.showinfo("No Matches", "No matching text found") 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:23,代碼來源:textarea.py

示例2: toggle_tabs_event

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def toggle_tabs_event(self, event):
        if self.askyesno(
              "Toggle tabs",
              "Turn tabs " + ("on", "off")[self.usetabs] +
              "?\nIndent width " +
              ("will be", "remains at")[self.usetabs] + " 8." +
              "\n Note: a tab is always 8 columns",
              parent=self.text):
            self.usetabs = not self.usetabs
            # Try to prevent inconsistent indentation.
            # User must change indent width manually after using tabs.
            self.indentwidth = 8
        return "break"

    # XXX this isn't bound to anything -- see tabwidth comments
##     def change_tabwidth_event(self, event):
##         new = self._asktabwidth()
##         if new != self.tabwidth:
##             self.tabwidth = new
##             self.set_indentation_params(0, guess=0)
##         return "break" 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:23,代碼來源:EditorWindow.py

示例3: cargarFB

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def cargarFB(self):

        try:
            rpta = msg.askyesno("Pregunta", "No se puede obtener información "+
                "de un video de facebook, desea continuar con la descarga?")

            if rpta:
                path = filedialog.asksaveasfilename()
                os.popen("facebook-dl.py {} hd {}".format(self.vista.url.get(),path))
                msg.showinfo("Mensaje", "Archivo descargado correctamente.")
                
        except:
            msg.showerror("Error", "El video no es público, o la url es inválida.")

        self.vista.button.config(state=NORMAL)
        self.vista.bvideo.config(state=NORMAL)
        self.vista.baudio.config(state=NORMAL)
        self.vista.bborrar.config(state=NORMAL)
        self.vista.config(cursor="") 
開發者ID:jjr4Programmer,項目名稱:proyectoDownloader,代碼行數:21,代碼來源:Controlador.py

示例4: reload_from_disk

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def reload_from_disk(self, event = None):
        # If we have opened a file, let's reload it from disk
        # We'll dump the current undo stack, and load it fresh
        if not self.current_plist:
            # Nothing to do - ding and bail
            self.bell()
            return
        # At this point - we should check if we have edited the file, and if so
        # prompt the user
        if self.edited:
            self.bell()
            if not mb.askyesno("Unsaved Changes","Any unsaved changes will be lost when reloading from disk. Continue?",parent=self):
                return
        # If we got here - we're okay with dumping changes (if any)
        try:
            with open(self.current_plist,"rb") as f:
                plist_data = plist.load(f,dict_type=dict if self.controller.settings.get("sort_dict",False) else OrderedDict)
        except Exception as e:
            # Had an issue, throw up a display box
            self.bell()
            mb.showerror("An Error Occurred While Opening {}".format(os.path.basename(self.current_plist)), str(e),parent=self)
            return
        # We should have the plist data now
        self.open_plist(self.current_plist,plist_data, self.plist_type_string.get()) 
開發者ID:corpnewt,項目名稱:ProperTree,代碼行數:26,代碼來源:plistwindow.py

示例5: sheetRightClick

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def sheetRightClick(sheet, event=[]):
	
	deleteSheet = messagebox.askyesno("Deletion Confirmation",
		"Would you like to delete the page "+sheet['name']+'?')

	if deleteSheet:
		filename = sheet['filename']
		print("deleting ", filename)


		cmd = 'rm '+filename

		subprocess.call(cmd+" >/dev/null 2>&1 &", shell=True)

		# now need to redraw window
		init_pages() 
開發者ID:tannerbohn,項目名稱:MindMap,代碼行數:18,代碼來源:wrapper.py

示例6: new_db

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def new_db(self, filename=''):
        """create a new database"""
        if filename == '':
            filename = filedialog.asksaveasfilename(
                initialdir=self.initialdir, defaultextension='.db',
                title="Define a new database name and location",
                filetypes=[("default", "*.db"), ("other", "*.db*"),
                           ("all", "*.*")])
        if filename != '':
            self.database_file = filename
            if os.path.isfile(filename):
                self.set_initialdir(filename)
                if messagebox.askyesno(
                   message='Confirm Destruction of previous Datas ?',
                   icon='question', title='Destroying'):
                    os.remove(filename)
            self.conn = Baresql(self.database_file)
            self.actualize_db() 
開發者ID:stonebig,項目名稱:sqlite_bro,代碼行數:20,代碼來源:sqlite_bro.py

示例7: deleteitem

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def deleteitem(self):
        index = self.listbox.curselection()
        try:
            item = self.listbox.get(index)
        except TclError:
            messagebox.showinfo('提示', '請選擇需刪除的項目!')
            # messagebox.showwarning('警告','請選擇需刪除的項目!')
            return

        if messagebox.askyesno('刪除', '刪除 %s ?' % item):
            self.listbox.delete(index)
            del self.urllist[item]
            messagebox.showinfo('提示', '刪除成功')
        else:
            # messagebox.showinfo('No', 'Quit has been cancelled')
            return

        # for item in index:
        #     print(self.listbox.get(item))
        #     self.listbox.delete(item)
        # print(index)
        # urlname = self.listbox.get(self.listbox.curselection())
        # print(urlname) 
開發者ID:turbobin,項目名稱:Open-Manager,代碼行數:25,代碼來源:OpenTool.py

示例8: check_convert_tabs_to_spaces

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def check_convert_tabs_to_spaces(self, chars):
        if not self.replace_tabs:
            return chars
        tab_count = chars.count("\t")
        if tab_count == 0:
            return chars
        else:

            if messagebox.askyesno(
                "Convert tabs to spaces?",
                "Thonny (according to Python recommendation) uses spaces for indentation, "
                + "but the text you are about to insert/open contains %d tab characters. "
                % tab_count
                + "To avoid confusion, it's better to convert them into spaces (unless you know they should be kept as tabs).\n\n"
                + "Do you want me to replace each tab with %d spaces?\n\n" % self.indent_width,
            ):
                return chars.expandtabs(self.indent_width)
            else:
                return chars 
開發者ID:thonny,項目名稱:thonny,代碼行數:21,代碼來源:tktextext.py

示例9: try_load_configuration

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def try_load_configuration(filename):
    if filename in _manager_cache:
        return _manager_cache[filename]

    try:
        # use cache so Workbench doesn't create duplicate manager
        # when FirstRunWindow already created one
        mgr = ConfigurationManager(filename)
        _manager_cache[filename] = mgr
        return mgr
    except configparser.Error:
        from tkinter import messagebox

        if os.path.exists(filename) and messagebox.askyesno(
            "Problem",
            "Thonny's configuration file can't be read. It may be corrupt.\n\n"
            + "Do you want to discard the file and open Thonny with default settings?",
        ):
            os.replace(filename, filename + "_corrupt")
            # For some reasons Thonny styles are not loaded properly once messagebox has been shown before main window (At least Windows Py 3.5)
            raise SystemExit("Configuration file has been discarded. Please restart Thonny!")
        else:
            raise 
開發者ID:thonny,項目名稱:thonny,代碼行數:25,代碼來源:config.py

示例10: _confirm_install

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def _confirm_install(self, package_data):
        name = package_data["info"]["name"]

        if name.lower().startswith("thonny"):
            return messagebox.askyesno(
                _("Confirmation"),
                _(
                    "Looks like you are installing a Thonny-related package.\n"
                    + "If you meant to install a Thonny plugin, then you should\n"
                    + "choose 'Tools → Manage plugins...' instead\n"
                    + "\n"
                    + "Are you sure you want to install %s for the back-end?"
                )
                % name,
            )
        else:
            return True 
開發者ID:thonny,項目名稱:thonny,代碼行數:19,代碼來源:pip_gui.py

示例11: exportVTK

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def exportVTK(self,proj):                    
        outfile = fd.asksaveasfilename()
        if outfile is not '':
            #thickness = sd.askfloat("Input","Profile thickness [m]")
            thickness = 0
            if self.asp is None:
                aspect = 1.0
            else:
                aspect = self.asp
            
            if proj.threeD is None:
                gpyes = mesbox.askyesno("Question","Do you have topography data for this profile?")
                if gpyes:
                    filename = fd.askopenfilename()
                    self.getDelimiter()
                    proj.exportVTK(outfile,gpsinfo=filename,thickness=thickness,delimiter=self.delimiter,aspect=aspect)
            else:
                proj.exportVTK(outfile,gpsinfo=proj.threeD,thickness=thickness,delimiter=self.delimiter,aspect=aspect)
            print('... done with exporting to VTK.') 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:21,代碼來源:gprpyGUI.py

示例12: yesno

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def yesno(subject, text):
        return messagebox.askyesno(subject, text) 
開發者ID:pabloibiza,項目名稱:WiCC,代碼行數:4,代碼來源:wicc_view_popup.py

示例13: say_goodbye

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def say_goodbye(self):
        if msgbox.askyesno("Close Window?", "Would you like to close this window?"):
            self.label_text.set("Window will close in 2 seconds")
            self.after(2000, self.destroy)
        else:
            msgbox.showinfo("Not Closing", "Great! This window will stay open.") 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:8,代碼來源:ch1-5.py

示例14: say_goodbye

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def say_goodbye(self):
        if msgbox.askyesno("Close Window?", "Would you like to close this window?"):
            message = "Window will close in 2 seconds - goodybye " + self.name_entry.get()
            self.label_text.set(message)
            self.after(2000, self.destroy)
        else:
            msgbox.showinfo("Not Closing", "Great! This window will stay open.") 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:9,代碼來源:ch1-6.py

示例15: start

# 需要導入模塊: from tkinter import messagebox [as 別名]
# 或者: from tkinter.messagebox import askyesno [as 別名]
def start(self) -> None:
        rs = self.rolling_shutter = RollingShutter(self.files,
                                                   self.tk_speed_val.get(),
                                                   self.file_output)
        
        lines_covered = rs.frame_count * self.tk_speed_val.get()
        
        if lines_covered < rs.height:
            m = ('The number of iterations ({}) is lower than the height'
                 ' of the resulting image ({}px).\n\nMissing spots ({} lines)'
                 ' will be filled with black.\n\n'
                 'Do you want to continue?')
            message = m.format(lines_covered,
                               rs.height,
                               rs.height-lines_covered)
            choice = askyesno('Proceed?', message)
                              
            if not choice:
                return None
            
        self.disable_buttons()
        self.progress_bar.config(maximum=lines_covered)
        self.progress_bar.state(['!disabled'])
        
        t1 = Thread(target=rs.thread, args=(self,))
        t1.setDaemon(True)
        t1.start() 
開發者ID:alexd3rsan,項目名稱:rollingshutterpy,代碼行數:29,代碼來源:rollingshutter.py


注:本文中的tkinter.messagebox.askyesno方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。