Tickmarker Flower

kivy_garden.tickmarker

TickMarker

The TickMarker widget places ticks in the center of the widget so that when combined with another widget e.g. a slider it would mark intervals. It supports horizontal and vertical orientation, minor/major ticks and log10 representation.

To create a log slider from 0.1 to 10 starting at 1 with major tick marks at every decade, and minor ticks at every 0.2 decades:

from kivy.uix.slider import Slider
from kivy.garden.tickmarker import TickMarker
class TickSlider(Slider, TickMarker):
    pass
s = TickSlider(log=True, min_log=.1, max_log=10, value_log=1,
               ticks_major=1, ticks_minor=5)

Or a linear slider from 10 to 200 starting at 60 with major tick marks at
every 50 units from start, and minor ticks at every 10 units
s = TickSlider(min=10, max=200, value=60, ticks_major=50, ticks_minor=5)

To create a log progress bar from 10 to 1000 starting at 500 with major tick marks at every decade, and minor ticks at every 0.1 decades:

from kivy.uix.progressbar import ProgressBar
from kivy.garden.tickmarker import TickMarker
class TickBar(ProgressBar, TickMarker):
    padding = NumericProperty(0)
    min = NumericProperty(0)
    orientation = OptionProperty('horizontal', options=('horizontal'))
s = TickBar(log=True, min_log=10, max_log=1000, value_log=500,
            ticks_major=1, ticks_minor=10)

When combining with another widget such as a slider, the widget must have min, max, value, orientation, and padding fields. See the second example above as to how you would do this with a ProgressBar. When the final widget is logarithmic you access the fields from min_log, max_log and value_log instead of from min, max, and value.

class kivy_garden.tickmarker.TickMarker(**kwargs)

Bases: kivy.uix.widget.Widget

Class for creating a TickMarker widget.

Check module documentation for more details.

log

Determines whether the ticks should be displayed logarithmically (True) or linearly (False).

log is a BooleanProperty, defaults to False.

max_log

Maximum value allowed for value_log when using logarithms.

max_log is a AliasProperty of max.

max_log values is only valid when log is True in order to prevent overflow when used with normal numbers.

min_log

Minimum value allowed for value_log when using logarithms.

min_log is a AliasProperty of min.

min_log values is only valid when log is True in order to prevent overflow when used with normal numbers.

ticks_major

Distance between major tick marks.

Determines the distance between the major tick marks. Major tick marks start from min and re-occur at every ticks_major until max. If max doesn’t overlap with a integer multiple of ticks_major, no tick will occur at max. Zero indicates no tick marks.

If log is true, then this indicates the distance between ticks in multiples of current decade. E.g. if min_log is 0.1 and ticks_major is 0.1, it means there will be a tick at every 10th of the decade, i.e. 0.1 … 0.9, 1, 2… If it is 0.3, the ticks will occur at 0.1, 0.3, 0.6, 0.9, 2, 5, 8, 10. You’ll notice that it went from 8 to 10 instead of to 20, that’s so that we can say 0.5 and have ticks at every half decade, e.g. 0.1, 0.5, 1, 5, 10, 50… Similarly, if ticks_major is 1.5, there will be ticks at 0.1, 5, 100, 5,000… Also notice, that there’s always a major tick at the start. Finally, if e.g. min_log is 0.6 and this 0.5 there will be ticks at 0.6, 1, 5…

ticks_major is a BoundedNumericProperty, defaults to 0.

ticks_minor

The number of sub-intervals that divide ticks_major.

Determines the number of sub-intervals into which ticks_major is divided, if non-zero. The actual number of minor ticks between the major ticks is ticks_minor - 1. Only used if ticks_major is non-zero. If there’s no major tick at max then the number of minor ticks after the last major tick will be however many ticks fit until max.

If self.log is true, then this indicates the number of intervals the distance between major ticks is divided. The result is the number of multiples of decades between ticks. I.e. if ticks_minor is 10, then if ticks_major is 1, there will be ticks at 0.1, 0.2…0.9, 1, 2, 3… If ticks_major is 0.3, ticks will occur at 0.1, 0.12, 0.15, 0.18… Finally, as is common, if ticks major is 1, and ticks minor is 5, there will be ticks at 0.1, 0.2, 0.4… 0.8, 1, 2…

ticks_minor is a BoundedNumericProperty, defaults to 0.

value_log

Current logarithmic value used for the widget.

value_log is a AliasProperty of value.

value_log values is only valid when log is True in order to prevent overflow when used with normal numbers.