• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tkinter_messagebox.showerror函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中six.moves.tkinter_messagebox.showerror函数的典型用法代码示例。如果您正苦于以下问题:Python showerror函数的具体用法?Python showerror怎么用?Python showerror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了showerror函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: save_figure

    def save_figure(self, *args):
        from six.moves import tkinter_tkfiledialog, tkinter_messagebox
        filetypes = self.canvas.get_supported_filetypes().copy()
        default_filetype = self.canvas.get_default_filetype()

        # Tk doesn't provide a way to choose a default filetype,
        # so we just have to put it first
        default_filetype_name = filetypes[default_filetype]
        del filetypes[default_filetype]

        sorted_filetypes = list(six.iteritems(filetypes))
        sorted_filetypes.sort()
        sorted_filetypes.insert(0, (default_filetype, default_filetype_name))

        tk_filetypes = [(name, '*.%s' % ext)
                        for (ext, name) in sorted_filetypes]

        # adding a default extension seems to break the
        # asksaveasfilename dialog when you choose various save types
        # from the dropdown.  Passing in the empty string seems to
        # work - JDH!
        #defaultextension = self.canvas.get_default_filetype()
        defaultextension = ''
        initialdir = rcParams.get('savefig.directory', '')
        initialdir = os.path.expanduser(initialdir)
        initialfile = self.canvas.get_default_filename()
        fname = tkinter_tkfiledialog.asksaveasfilename(
            master=self.window,
            title='Save the figure',
            filetypes=tk_filetypes,
            defaultextension=defaultextension,
            initialdir=initialdir,
            initialfile=initialfile,
        )

        if fname == "" or fname == ():
            return
        else:
            if initialdir == '':
                # explicitly missing key or empty str signals to use cwd
                rcParams['savefig.directory'] = initialdir
            else:
                # save dir for next time
                rcParams['savefig.directory'] = os.path.dirname(
                    six.text_type(fname))
            try:
                # This method will handle the delegation to the correct type
                self.canvas.print_figure(fname)
            except Exception as e:
                tkinter_messagebox.showerror("Error saving file", str(e))
开发者ID:efiring,项目名称:matplotlib,代码行数:50,代码来源:backend_tkagg.py


示例2: save_figure

    def save_figure(self, *args):
        from six.moves import tkinter_tkfiledialog, tkinter_messagebox
        filetypes = self.canvas.get_supported_filetypes().copy()
        default_filetype = self.canvas.get_default_filetype()

        # Tk doesn't provide a way to choose a default filetype,
        # so we just have to put it first
        default_filetype_name = filetypes.pop(default_filetype)
        sorted_filetypes = ([(default_filetype, default_filetype_name)]
                            + sorted(six.iteritems(filetypes)))
        tk_filetypes = [(name, '*.%s' % ext) for ext, name in sorted_filetypes]

        # adding a default extension seems to break the
        # asksaveasfilename dialog when you choose various save types
        # from the dropdown.  Passing in the empty string seems to
        # work - JDH!
        #defaultextension = self.canvas.get_default_filetype()
        defaultextension = ''
        initialdir = os.path.expanduser(rcParams['savefig.directory'])
        initialfile = self.canvas.get_default_filename()
        fname = tkinter_tkfiledialog.asksaveasfilename(
            master=self.window,
            title='Save the figure',
            filetypes=tk_filetypes,
            defaultextension=defaultextension,
            initialdir=initialdir,
            initialfile=initialfile,
            )

        if fname in ["", ()]:
            return
        # Save dir for next time, unless empty str (i.e., use cwd).
        if initialdir != "":
            rcParams['savefig.directory'] = (
                os.path.dirname(six.text_type(fname)))
        try:
            # This method will handle the delegation to the correct type
            self.canvas.figure.savefig(fname)
        except Exception as e:
            tkinter_messagebox.showerror("Error saving file", str(e))
开发者ID:pwuertz,项目名称:matplotlib,代码行数:40,代码来源:_backend_tk.py


示例3: error_msg_tkpaint

def error_msg_tkpaint(msg, parent=None):
    from six.moves import tkinter_messagebox as tkMessageBox
    tkMessageBox.showerror("matplotlib", msg)
开发者ID:pwuertz,项目名称:matplotlib,代码行数:3,代码来源:_backend_tk.py


示例4: sort_to_send

    def sort_to_send(self):
        """The data is collected and prepared here"""
        course_names = self.courseName.get().split()
        courses.append(*course_names)
        self.Init_data = {}

        if not self.username.get():
            creds = CS.get_netrc_creds()
            if not creds:
                tkMessageBox.showerror('Error',"No username passed and no .netrc credentials found, unable to login")
                return False
            else:
                username, password = creds
        else:
            username = self.username.get()
            # prompt the user for his password if not specified
            if not self.password.get():
                password = getpass.getpass()
            else:
                password = self.password.get()

        # should we be trimming paths?
        # TODO: this is a simple hack, something more elaborate needed
        mppl = None
        try:
            if self.mppl_entry.get() and int(self.mppl_entry.get()) > 0:
                #if mppl specified, always use that
                mppl = int(self.mppl_entry.get())
            elif platform.system() == "Windows":
                # if mppl is not specified on windows set manually
                mppl = 90
            else:
                # linux max path length is typically around 4060 so assume thats ok
                pass
        except ValueError:
            tkMessageBox.showerror('Error','Maximum length of a path component should be a positive integer')
            return False

        self.Init_data['max_path_part_len'] = mppl

        if self.proxy.get():
             self.Init_data['proxy']= self.proxy.get()

        if self.parser.get():
            self.Init_data['parser'] = self.parser.get()

        if self.gzip_courses:
            self.Init_data['gzip_courses'] = True

        if self.wkfilter.get():
            self.Init_data['wk_filter'] = self.wkfilter.get()

        if self.ignoreFiles.get():
            self.Init_data['ignorefiles']= self.ignoreFiles.get()
        else:
        # Ignorefiles is a bit buggy, as it would cause a AttributeError if not passed an empty string if the user hasn't entered anything
            self.Init_data['ignorefiles']= ''

        if not self.destination:
            self.destination = self.directory.get()

        queue.append([username,password])
        queue.append(self.Init_data)
        queue.append([self.destination,
                    bool(self.reverse.get()),
                    bool(self.gzip_courses.get())])
        return True
开发者ID:K-DawG007,项目名称:coursera-dl,代码行数:67,代码来源:gui.py



注:本文中的six.moves.tkinter_messagebox.showerror函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python parse.parse_qs函数代码示例发布时间:2022-05-27
下一篇:
Python tkinter.Frame类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap