How to use the ttkwidgets.utilities.get_bitmap function in ttkwidgets

To help you get started, we’ve selected a few ttkwidgets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TkinterEP / ttkwidgets / ttkwidgets / dirtreewidget.py View on Github external
ptype = "file"

            fname = os.path.split(p)[1]
            id_ = self.tree.insert(node, "end", text=fname, values=[p, ptype])

            if ptype == 'directory':
                if fname not in ('.', '..'):
                    self.images.append(get_bitmap("folder"))
                    self.tree.insert(id_, 0, text="dummy")
                    self.tree.item(id_, text=fname,
                                   image=self.images[-1],
                                   tags=("base",))
            elif ptype == 'file':
                mimetype = mimetypes.guess_type(fname)[0].split("/")[0]
                if mimetype == "image":
                    img = get_bitmap("imagefile")
                elif mimetype == "video":
                    img = get_bitmap("moviefile")
                elif mimetype == "audio":
                    img = get_bitmap("musicfile")
                else:
                    img = get_bitmap("textfile")
                self.images.append(img)
                self.tree.item(id_, image=self.images[-1])
github TkinterEP / ttkwidgets / ttkwidgets / dirtreewidget.py View on Github external
if fname not in ('.', '..'):
                    self.images.append(get_bitmap("folder"))
                    self.tree.insert(id_, 0, text="dummy")
                    self.tree.item(id_, text=fname,
                                   image=self.images[-1],
                                   tags=("base",))
            elif ptype == 'file':
                mimetype = mimetypes.guess_type(fname)[0].split("/")[0]
                if mimetype == "image":
                    img = get_bitmap("imagefile")
                elif mimetype == "video":
                    img = get_bitmap("moviefile")
                elif mimetype == "audio":
                    img = get_bitmap("musicfile")
                else:
                    img = get_bitmap("textfile")
                self.images.append(img)
                self.tree.item(id_, image=self.images[-1])
github TkinterEP / ttkwidgets / ttkwidgets / dirtreewidget.py View on Github external
special_dirs = []

        for p in special_dirs + os.listdir(path):
            ptype = None
            p = os.path.join(path, p).replace('\\', '/')
            if os.path.isdir(p):
                ptype = "directory"
            elif os.path.isfile(p):
                ptype = "file"

            fname = os.path.split(p)[1]
            id_ = self.tree.insert(node, "end", text=fname, values=[p, ptype])

            if ptype == 'directory':
                if fname not in ('.', '..'):
                    self.images.append(get_bitmap("folder"))
                    self.tree.insert(id_, 0, text="dummy")
                    self.tree.item(id_, text=fname,
                                   image=self.images[-1],
                                   tags=("base",))
            elif ptype == 'file':
                mimetype = mimetypes.guess_type(fname)[0].split("/")[0]
                if mimetype == "image":
                    img = get_bitmap("imagefile")
                elif mimetype == "video":
                    img = get_bitmap("moviefile")
                elif mimetype == "audio":
                    img = get_bitmap("musicfile")
                else:
                    img = get_bitmap("textfile")
                self.images.append(img)
                self.tree.item(id_, image=self.images[-1])
github TkinterEP / ttkwidgets / ttkwidgets / dirtreewidget.py View on Github external
if ptype == 'directory':
                if fname not in ('.', '..'):
                    self.images.append(get_bitmap("folder"))
                    self.tree.insert(id_, 0, text="dummy")
                    self.tree.item(id_, text=fname,
                                   image=self.images[-1],
                                   tags=("base",))
            elif ptype == 'file':
                mimetype = mimetypes.guess_type(fname)[0].split("/")[0]
                if mimetype == "image":
                    img = get_bitmap("imagefile")
                elif mimetype == "video":
                    img = get_bitmap("moviefile")
                elif mimetype == "audio":
                    img = get_bitmap("musicfile")
                else:
                    img = get_bitmap("textfile")
                self.images.append(img)
                self.tree.item(id_, image=self.images[-1])