Esempio n. 1
0
    def set(self, lo, hi):
        """
        Set scrollbar slider's end positions.

        @param lo: Low end position. A float value between 0.0 and 1.0.

        @param hi: High end position. A float value between 0.0 and 1.0.

        @return: None.
        """
        # If scrollbar slider's both ends reached extreme position
        if float(lo) <= 0.0 and float(hi) >= 1.0:
            # Hide the scrollbar
            self.grid_remove()

        # If not scrollbar slider's both ends reached extreme position
        else:
            # Show the scrollbar
            self.grid()

        # Call super version
        Scrollbar.set(self, lo, hi)
Esempio n. 2
0
 def set(self, lo, hi):
     if float(lo) <= 0.0 and float(hi) >= 1.0:
         self.grid_remove()
     else:
         self.grid()
     Scrollbar.set(self, lo, hi)
Esempio n. 3
0
'''
from tkinter import Tk
from tkinter.ttk import Style, Scrollbar

root = Tk()
style = Style()
style.theme_use('classic')

style.configure("1st.Horizontal.TScrollbar",
                background="Green",
                troughcolor="lightblue",
                bordercolor="blue",
                arrowsize=20,
                borderwidth=5)

style.configure("2nd.Horizontal.TScrollbar",
                background="Green",
                troughcolor="lightblue",
                bordercolor="blue",
                arrowsize=20)

hs = Scrollbar(root, orient="horizontal", style="1st.Horizontal.TScrollbar")
hs.place(x=5, y=5, width=150)
hs.set(0.2, 0.3)

hs2 = Scrollbar(root, orient="horizontal", style="2nd.Horizontal.TScrollbar")
hs2.place(x=5, y=50, width=150)
hs2.set(0.2, 0.3)

root.mainloop()
Esempio n. 4
0
 def set(self, lo, hi):
     if float(lo) <= 0.0 and float(hi) >= 1.0:
         self.tk.call("grid", "remove", self)
     else:
         self.grid()
     Scrollbar.set(self, lo, hi)