How to use the ttkwidgets.ScaleEntry 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_scaleentry.py View on Github external
def test_scaleentry_init(self):
        scale = ScaleEntry(self.window)
        scale.pack()
        self.window.update()
github TkinterEP / ttkwidgets / tests / test_scaleentry.py View on Github external
def test_scaleentry_scale(self):
        scale = ScaleEntry(self.window)
        scale.pack()
        self.window.update()
        scale.config_scale(length=100)
        self.window.update()
        self.assertEqual(scale.cget_scale('length'), 100)
        try:
            info = scale._scale.grid_info()
        except TypeError:
            # bug in some tkinter versions
            res = str(scale.tk.call('grid', 'info', scale._scale._w)).split("-")
            info = {}
            for i in res:
                if i:
                    key, val = i.strip().split()
                    info[key] = val
        self.assertEqual(info['sticky'], 'ew')
github TkinterEP / ttkwidgets / tests / test_scaleentry.py View on Github external
        self.assertRaises(TypeError, lambda: ScaleEntry(self.window, entryscalepad='a'))
github TkinterEP / ttkwidgets / tests / test_scaleentry.py View on Github external
def test_scaleentry_property(self):
        scale = ScaleEntry(from_=50)
        self.assertEqual(scale.value, 50)
github TkinterEP / ttkwidgets / tests / test_scaleentry.py View on Github external
def test_scaleentry_methods(self):
        scale = ScaleEntry(self.window, scalewidth=100, entrywidth=4, from_=-10,
                           to=10, orient=tk.VERTICAL, compound=tk.TOP,
                           entryscalepad=10)
        scale.pack()
        self.window.update()
        keys = ['borderwidth', 'padding', 'relief', 'width', 'height',
                'takefocus', 'cursor', 'style', 'class', 'scalewidth', 'orient',
                'entrywidth', 'from', 'to', 'compound', 'entryscalepad']
        keys.sort()
        self.assertEqual(scale.keys(), keys)
        self.assertEqual(scale['orient'], tk.VERTICAL)
        self.assertEqual(scale['scalewidth'], 100)
        self.assertEqual(scale['entrywidth'], 4)
        self.assertEqual(scale['from'], -10)
        self.assertEqual(scale['to'], 10)
        self.assertEqual(scale['compound'], tk.TOP)
        self.assertEqual(scale['entryscalepad'], 10)
github TkinterEP / ttkwidgets / tests / test_scaleentry.py View on Github external
def test_scaleentry_entry(self):
        scale = ScaleEntry(self.window, from_=0, to=50)
        scale.pack()
        self.window.update()
        scale.config_entry(width=10)
        self.window.update()
        self.assertEqual(scale.cget_entry('width'), 10)
        scale._entry.delete(0, tk.END)
        scale._entry.insert(0, "5")
        scale._on_entry(None)
        self.assertEqual(scale._variable.get(), 5)
        scale._entry.insert(0, "a")
        scale._on_entry(None)
        self.assertEqual(scale._variable.get(), 5)
        scale._entry.insert(0, "")
        scale._on_entry(None)
        self.assertEqual(scale._variable.get(), 5)
github TkinterEP / ttkwidgets / tests / test_scaleentry.py View on Github external
        self.assertRaises(ValueError, lambda: ScaleEntry(compound="something!"))
        self.assertRaises(TypeError, lambda: ScaleEntry(self.window, entryscalepad='a'))
github TkinterEP / ttkwidgets / examples / example_scaleentry.py View on Github external
# -*- coding: utf-8 -*-

# Copyright (c) Juliette Monsel 2018
# For license see LICENSE

from ttkwidgets import ScaleEntry
import tkinter as tk


window = tk.Tk()
scaleentry = ScaleEntry(window, scalewidth=200, entrywidth=3, from_=0, to=20)
scaleentry.config_entry(justify='center')
scaleentry.pack()
window.mainloop()