How to use the ttkwidgets.TickScale 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 / tests / test_tickscale.py View on Github external
def test_tickscale_init(self):
        TickScale(self.window, orient='vertical', style='my.Vertical.TScale',
                  tickinterval=0.2, from_=-1, to=1, showvalue=True,
                  digits=2, length=400, cursor='watch').pack()
        self.window.update()
        TickScale(self.window, orient='horizontal', from_=0, to=10,
                  tickinterval=0, tickpos='n', labelpos='s',
                  showvalue=False).pack()
        self.window.update()

        with self.assertRaises(ValueError):
            TickScale(self.window, orient='vertical', tickpos='n')

        with self.assertRaises(ValueError):
            TickScale(self.window, orient='horizontal', tickpos='e')

        with self.assertRaises(ValueError):
            TickScale(self.window, labelpos='ne')
github TkinterEP / ttkwidgets / tests / test_tickscale.py View on Github external
def test_tickscale_init(self):
        TickScale(self.window, orient='vertical', style='my.Vertical.TScale',
                  tickinterval=0.2, from_=-1, to=1, showvalue=True,
                  digits=2, length=400, cursor='watch').pack()
        self.window.update()
        TickScale(self.window, orient='horizontal', from_=0, to=10,
                  tickinterval=0, tickpos='n', labelpos='s',
                  showvalue=False).pack()
        self.window.update()

        with self.assertRaises(ValueError):
            TickScale(self.window, orient='vertical', tickpos='n')

        with self.assertRaises(ValueError):
            TickScale(self.window, orient='horizontal', tickpos='e')

        with self.assertRaises(ValueError):
            TickScale(self.window, labelpos='ne')
github TkinterEP / ttkwidgets / tests / test_tickscale.py View on Github external
def test_tickscale_init(self):
        TickScale(self.window, orient='vertical', style='my.Vertical.TScale',
                  tickinterval=0.2, from_=-1, to=1, showvalue=True,
                  digits=2, length=400, cursor='watch').pack()
        self.window.update()
        TickScale(self.window, orient='horizontal', from_=0, to=10,
                  tickinterval=0, tickpos='n', labelpos='s',
                  showvalue=False).pack()
        self.window.update()

        with self.assertRaises(ValueError):
            TickScale(self.window, orient='vertical', tickpos='n')

        with self.assertRaises(ValueError):
            TickScale(self.window, orient='horizontal', tickpos='e')

        with self.assertRaises(ValueError):
            TickScale(self.window, labelpos='ne')
github TkinterEP / ttkwidgets / tests / test_tickscale.py View on Github external
scale['orient'] = 'vertical'
        self.window.update()

        scale['tickpos'] = 'e'
        self.window.update()
        self.assertEqual(scale['tickpos'], 'e')

        with self.assertRaises(ValueError):
            scale.configure(orient='vertical', tickpos='n')

        with self.assertRaises(ValueError):
            scale.configure(orient='horizontal', tickpos='e')

        with self.assertRaises(ValueError):
            TickScale(self.window, labelpos='ne')

        scale.configure(style='my.Vertical.TScale')
        self.window.update()
        scale.style.configure('my.Vertical.TScale', font='TkDefaultFont 20 italic',
                              sliderlength=50)

        scale.x = 0

        def cmd(value):
            scale.x = 2 * float(value)

        scale.configure(command=cmd)
        self.window.update()
        scale.configure(digits=1)
        scale.set(10)
        self.window.update()
github TkinterEP / ttkwidgets / tests / test_tickscale.py View on Github external
def test_tickscale_methods(self):
        scale = TickScale(self.window, from_=0, to=10, orient='horizontal')
        scale.pack()
        self.window.update()
        self.assertEqual(scale.cget('digits'), -1)
        self.assertEqual(scale['tickinterval'], 0)
        self.assertEqual(scale['resolution'], 0)
        self.assertTrue(scale.cget('showvalue'))
        self.assertEqual(scale['from'], 0)
        self.assertEqual(scale.cget('to'), 10)
        keys = ttk.Scale(self.window).keys() + ['showvalue', 'tickinterval', 'digits']

        self.assertEqual(sorted(scale.keys()), sorted(keys))

        scale.config(from_=-1)
        self.window.update()
        self.assertEqual(scale['from'], -1)
github TkinterEP / ttkwidgets / tests / test_tickscale.py View on Github external
tickinterval=0.2, from_=-1, to=1, showvalue=True,
                  digits=2, length=400, cursor='watch').pack()
        self.window.update()
        TickScale(self.window, orient='horizontal', from_=0, to=10,
                  tickinterval=0, tickpos='n', labelpos='s',
                  showvalue=False).pack()
        self.window.update()

        with self.assertRaises(ValueError):
            TickScale(self.window, orient='vertical', tickpos='n')

        with self.assertRaises(ValueError):
            TickScale(self.window, orient='horizontal', tickpos='e')

        with self.assertRaises(ValueError):
            TickScale(self.window, labelpos='ne')
github TkinterEP / ttkwidgets / examples / example_tickscale.py View on Github external
root = tk.Tk()
style = ttk.Style(root)
style.theme_use('clam')
style.configure('my.Vertical.TScale', sliderlength=50, background='white',
                foreground='red')
style.configure('my.Horizontal.TScale', sliderlength=10,
                font='TkDefaultFont 20 italic')
s1 = TickScale(root, orient='vertical', style='my.Vertical.TScale',
               tickinterval=0.2, from_=-1, to=1, showvalue=True, digits=2,
               length=400, labelpos='e')
s2 = TickScale(root, orient='horizontal', style='my.Horizontal.TScale',
               from_=0, to=10, tickinterval=2, resolution=1,
               showvalue=True, length=400)
s3 = TickScale(root, orient='horizontal', from_=0.25, to=1, tickinterval=0.1,
               resolution=0.1)

s1.pack(fill='y')
s2.pack(fill='x')
s3.pack(fill='x')

root.mainloop()
github TkinterEP / ttkwidgets / examples / example_tickscale.py View on Github external
# Copyright (c) Juliette Monsel 2017
# For license see LICENSE
from ttkwidgets import TickScale
import tkinter as tk
from tkinter import ttk


root = tk.Tk()
style = ttk.Style(root)
style.theme_use('clam')
style.configure('my.Vertical.TScale', sliderlength=50, background='white',
                foreground='red')
style.configure('my.Horizontal.TScale', sliderlength=10,
                font='TkDefaultFont 20 italic')
s1 = TickScale(root, orient='vertical', style='my.Vertical.TScale',
               tickinterval=0.2, from_=-1, to=1, showvalue=True, digits=2,
               length=400, labelpos='e')
s2 = TickScale(root, orient='horizontal', style='my.Horizontal.TScale',
               from_=0, to=10, tickinterval=2, resolution=1,
               showvalue=True, length=400)
s3 = TickScale(root, orient='horizontal', from_=0.25, to=1, tickinterval=0.1,
               resolution=0.1)

s1.pack(fill='y')
s2.pack(fill='x')
s3.pack(fill='x')

root.mainloop()
github TkinterEP / ttkwidgets / examples / example_tickscale.py View on Github external
from ttkwidgets import TickScale
import tkinter as tk
from tkinter import ttk


root = tk.Tk()
style = ttk.Style(root)
style.theme_use('clam')
style.configure('my.Vertical.TScale', sliderlength=50, background='white',
                foreground='red')
style.configure('my.Horizontal.TScale', sliderlength=10,
                font='TkDefaultFont 20 italic')
s1 = TickScale(root, orient='vertical', style='my.Vertical.TScale',
               tickinterval=0.2, from_=-1, to=1, showvalue=True, digits=2,
               length=400, labelpos='e')
s2 = TickScale(root, orient='horizontal', style='my.Horizontal.TScale',
               from_=0, to=10, tickinterval=2, resolution=1,
               showvalue=True, length=400)
s3 = TickScale(root, orient='horizontal', from_=0.25, to=1, tickinterval=0.1,
               resolution=0.1)

s1.pack(fill='y')
s2.pack(fill='x')
s3.pack(fill='x')

root.mainloop()