How to customize the label of a tkinter Scale widget by adding a percentage sign
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 wa开发者_运维问答y to add that percent sign. Any help, or a definitive "that is not possible" would be appreciated. Thanks.
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.
精彩评论