当前位置: 首页>>代码示例>>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;未经允许,请勿转载。