How to customize the label of a tkinter Scale widget by adding a percentage sign

1.4k views Asked by At

I'm working with a Tkinter scale, where the selected value is somewhere between 0 and 100, representing a percentage. Is there a way for the value displayed to have a % percent sign following it?

I want it to look like the following (roughly):

             75%  
|-------------o----|

Currently I cannot figure a way to add that percent sign. Any help, or a definitive "that is not possible" would be appreciated. Thanks.

1

There are 1 answers

1
Bryan Oakley On BEST ANSWER

It's not possible with the options provided by the control.

However, it is possible to turn the value off and use your own string. Since you know the value of the slider and you know the length, you can calculate the pixel that represents the center of the slider. With that information you can place a label widget at the appropriate place and put whatever string you want in the label.