Luther
Luther

Reputation: 574

Tick Marks not Displaying - Tkinter Scale

None of the tkinter Scales I've made show tickmarks.

I tried pasting other people's code into my editor and same result, no ticks. The example is utterly simple so I couldn't think of anything to try except different values for the tickinterval option. I'm using tkinter 8.6 with python 3.5. Thanks for any assistance.

import tkinter as tk

root = tk.Tk()

flt = tk.Scale(
    root,
    label="No Ticks", 
    from_=50.0, 
    to=200.0, 
    length=900, 
    orient="horizontal", 
    resolution=25, 
    tickinterval=50.0)

flt.grid()

root.mainloop()

There are no error messages and everything else seems to work.

Upvotes: 1

Views: 1357

Answers (1)

Luther
Luther

Reputation: 574

The option tickinterval does not refer to tick marks but to the numbers displayed along the Scale.

Once this was pointed out by Bryan Oakley in the comments, I was able to glean the following information from running simple examples, which I had not found in the docs. Basically, the resolution option and the tickinterval option values need to be considered together for both to work as desired.

tickinterval

Using the default value of zero, the only number shown will be the one which names the position of the slider. Otherwise the tickinterval will be the distance apart of numbers marking positions on the Scale. To be sure tickintervals will be displayed as desired, this should be set to an even multiple of resolution e.g. if resolution = 100, tickinterval should be 200 or 300 etc. If resolution is set to 0 or -1, tickinterval will display at any increment desired.

Upvotes: 1

Related Questions