How to use the ttkwidgets.AutoHideScrollbar 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 / frames / scrolledframe.py View on Github external
:type compound: str
        :param canvasheight: height of the internal canvas
        :type canvasheight: int
        :param canvaswidth: width of the internal canvas
        :type canvaswidth: int
        :param canvasborder: border width of the internal canvas
        :type canvasborder: int
        :param autohidescrollbar: whether to use an :class:`~ttkwidgets.AutoHideScrollbar` or a :class:`ttk.Scrollbar`
        :type autohidescrollbar: bool
        :param kwargs: keyword arguments passed on to the :class:`ttk.Frame` initializer
        """
        ttk.Frame.__init__(self, master, **kwargs)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(1, weight=1)
        if autohidescrollbar:
            self._scrollbar = AutoHideScrollbar(self, orient=tk.VERTICAL)
        else:
            self._scrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL)
        self._canvas = tk.Canvas(self, borderwidth=canvasborder, highlightthickness=0,
                                 yscrollcommand=self._scrollbar.set, width=canvaswidth, height=canvasheight)
        self.__compound = compound
        self._scrollbar.config(command=self._canvas.yview)
        self._canvas.yview_moveto(0)
        self.interior = ttk.Frame(self._canvas)
        self._interior_id = self._canvas.create_window(0, 0, window=self.interior, anchor=tk.NW)
        self.interior.bind("", self.__configure_interior)
        self._canvas.bind("", self.__configure_canvas)
        self.__grid_widgets()
github TkinterEP / ttkwidgets / ttkwidgets / timeline.py View on Github external
def configure(self, cnf={}, **kwargs):
        """Update options of the TimeLine widget"""
        kwargs.update(cnf)
        TimeLine.check_kwargs(kwargs)
        scrollbars = 'autohidescrollbars' in kwargs
        for option in self.options:
            attribute = "_" + option
            setattr(self, attribute, kwargs.pop(option, getattr(self, attribute)))
        if scrollbars:
            self._scrollbar_timeline.destroy()
            self._scrollbar_vertical.destroy()
            if self._autohidescrollbars:
                self._scrollbar_timeline = AutoHideScrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
                self._scrollbar_vertical = AutoHideScrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
            else:
                self._scrollbar_timeline = ttk.Scrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
                self._scrollbar_vertical = ttk.Scrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
            self._canvas_scroll.config(xscrollcommand=self._scrollbar_timeline.set,
                                       yscrollcommand=self._scrollbar_vertical.set)
            self._canvas_categories.config(yscrollcommand=self._scrollbar_vertical.set)
            self._scrollbar_timeline.grid(column=1, row=2, padx=(0, 5), pady=(0, 5), sticky="we")
            self._scrollbar_vertical.grid(column=2, row=0, pady=5, padx=(0, 5), sticky="ns")
        ttk.Frame.configure(self, **kwargs)
        self.draw_timeline()
github TkinterEP / ttkwidgets / ttkwidgets / debugwindow.py View on Github external
self.wm_title(title)
        self._oldstdout = sys.stdout
        self._oldstderr = sys.stderr
        if stdout:
            sys.stdout = self
        if stderr:
            sys.stderr = self
        self.menu = tk.Menu(self)
        self.config(menu=self.menu)
        self.filemenu = tk.Menu(self.menu, tearoff=0)
        self.filemenu.add_command(label="Save file", command=self.save)
        self.filemenu.add_command(label="Exit", command=self.quit)
        self.menu.add_cascade(label="File", menu=self.filemenu)
        self.text = tk.Text(self, width=width, wrap=tk.WORD)
        if autohidescrollbar:
            self.scroll = AutoHideScrollbar(self, orient=tk.VERTICAL, command=self.text.yview)
        else:
            self.scroll = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.text.yview)
        self.text.config(yscrollcommand=self.scroll.set)
        self.text.bind("", lambda e: "break")
        self._grid_widgets()
github TkinterEP / ttkwidgets / ttkwidgets / autocomplete / autocomplete_entrylistbox.py View on Github external
# completion settings
        self._allow_other_values = kwargs.pop('allow_other_values', self._allow_other_values)
        if 'completevalues' in kwargs:
            completevalues = kwargs.pop('completevalues')
            self._completevalues = completevalues
            self.listbox.delete(0, 'end')
            for c in self._completevalues:
                self.listbox.insert('end', c)

        # autohidescrollbar
        autohidescrollbar = isinstance(self._scrollbar, AutoHideScrollbar)
        autohidescrollbar2 = kwargs.pop('autohidescrollbar', autohidescrollbar)
        if autohidescrollbar != autohidescrollbar2:
            self._scrollbar.destroy()
            if autohidescrollbar2:
                self._scrollbar = AutoHideScrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview)
            else:
                self._scrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview)
            self.listbox.configure(yscrollcommand=self._scrollbar.set)
            self._scrollbar.grid(row=1, column=1, sticky='ns')
        # entry/listbox settings
        entry_listbox_kw = {}
        for key in ['font', 'exportselection', 'width']:
            if key in kwargs:
                entry_listbox_kw[key] = kwargs.pop(key)
        self.entry.configure(entry_listbox_kw)
        self.listbox.configure(entry_listbox_kw)
        if 'justify' in kwargs:
            justify = kwargs.pop('justify')
            self.entry.configure(justify=justify)
            try:
                self.listbox.configure(justify=justify)   # this is an option only for tk >= 8.6.5
github TkinterEP / ttkwidgets / ttkwidgets / timeline.py View on Github external
def configure(self, cnf={}, **kwargs):
        """Update options of the TimeLine widget"""
        kwargs.update(cnf)
        TimeLine.check_kwargs(kwargs)
        scrollbars = 'autohidescrollbars' in kwargs
        for option in self.options:
            attribute = "_" + option
            setattr(self, attribute, kwargs.pop(option, getattr(self, attribute)))
        if scrollbars:
            self._scrollbar_timeline.destroy()
            self._scrollbar_vertical.destroy()
            if self._autohidescrollbars:
                self._scrollbar_timeline = AutoHideScrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
                self._scrollbar_vertical = AutoHideScrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
            else:
                self._scrollbar_timeline = ttk.Scrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
                self._scrollbar_vertical = ttk.Scrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
            self._canvas_scroll.config(xscrollcommand=self._scrollbar_timeline.set,
                                       yscrollcommand=self._scrollbar_vertical.set)
            self._canvas_categories.config(yscrollcommand=self._scrollbar_vertical.set)
            self._scrollbar_timeline.grid(column=1, row=2, padx=(0, 5), pady=(0, 5), sticky="we")
            self._scrollbar_vertical.grid(column=2, row=0, pady=5, padx=(0, 5), sticky="ns")
        ttk.Frame.configure(self, **kwargs)
        self.draw_timeline()
github TkinterEP / ttkwidgets / ttkwidgets / autocomplete / autocomplete_entrylistbox.py View on Github external
def configure(self, cnf={}, **kw):
        kwargs = {}
        kwargs.update(cnf)
        kwargs.update(kw)
        # completion settings
        self._allow_other_values = kwargs.pop('allow_other_values', self._allow_other_values)
        if 'completevalues' in kwargs:
            completevalues = kwargs.pop('completevalues')
            self._completevalues = completevalues
            self.listbox.delete(0, 'end')
            for c in self._completevalues:
                self.listbox.insert('end', c)

        # autohidescrollbar
        autohidescrollbar = isinstance(self._scrollbar, AutoHideScrollbar)
        autohidescrollbar2 = kwargs.pop('autohidescrollbar', autohidescrollbar)
        if autohidescrollbar != autohidescrollbar2:
            self._scrollbar.destroy()
            if autohidescrollbar2:
                self._scrollbar = AutoHideScrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview)
            else:
                self._scrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview)
            self.listbox.configure(yscrollcommand=self._scrollbar.set)
            self._scrollbar.grid(row=1, column=1, sticky='ns')
        # entry/listbox settings
        entry_listbox_kw = {}
        for key in ['font', 'exportselection', 'width']:
            if key in kwargs:
                entry_listbox_kw[key] = kwargs.pop(key)
        self.entry.configure(entry_listbox_kw)
        self.listbox.configure(entry_listbox_kw)