TickScale

class ttkwidgets.TickScale(master=None, **kwargs)[source]

Bases: ttk.Frame

A ttk.Scale that can display the current value next to the slider and supports ticks.

__init__(master=None, **kwargs)[source]

Create a TickScale with parent master.

Parameters:
  • master (widget) – master widget
  • digits (int) – number of digits after the comma to display, if negative use the %g format
  • labelpos (str) – “n”, “s”, “e or “w”: if showvalue is True, position of the label
  • resolution (float) – increment by which the slider can be moved. 0 means continuous sliding.
  • showvalue (bool) – whether to display current value next to the slider
  • tickinterval (float) – if not 0, display ticks with the given interval
  • tickpos (str) – “w” or “e” (vertical scale), “n” or “s” (horizontal scale): if tickinterval is not 0, position of the ticks
  • kwargs – options to be passed on to the ttk.Scale initializer (class, cursor, style, takefocus, command, from, length, orient, to, value, variable)

Note

The style must derive from “Vertical.TScale” or “Horizontal.TScale” depending on the orientation. Depending on the theme, the default slider length might not be correct. If it is the case, this can be solve by setting the ‘sliderlength’ through ttk.Style.

cget(key)[source]

Query widget option.

Parameters:key (str) – option name
Returns:value of the option

To get the list of options for this widget, call the method keys().

config(cnf={}, **kw)

Configure resources of the widget.

To get the list of options for this widget, call the method keys(). See __init__() for a description of the widget specific option.

configure(cnf={}, **kw)[source]

Configure resources of the widget.

To get the list of options for this widget, call the method keys(). See __init__() for a description of the widget specific option.

convert_to_pixels(value)[source]

Convert value in the scale’s unit into a position in pixels.

Parameters:value (float) – value to convert
Returns:the corresponding position in pixels
Return type:float