Relative size of Python Tkinter scale widget

4.5k views Asked by At

I'm using the place() method of assigning the location of slider bars on my application window. I am using relx, rely, and relwidth to control where the sliders go to make sure they scale up when I maximize the window.

The slider bars are in a horizontal position, and take up most of the width of my screen. I can't figure out how to adjust the "thickness/height?" of the slider bar relative to the screen.

You can do width = ... to adjust the thickness permanently, but I'm finding that you can't use relheight = ... to do it relative to the screen.

Can someone help me adjust this parameter relative to the parent widget size?

sweetSlider = Scale(app, orient=HORIZONTAL,width=30,from_=0,to=100,showvalue=0,variable=sweetVar)
sweetSlider.place(relx=0.15,rely=0.06,relwidth=0.7)

In the above, relx and rely are the placement of the upper left corner of the slider on my GUI screen (app). relwidth=0.7 sets the width of the slider always to 70% the width of the screen.

I wish to set the other dimension of the slider, the "height" in the same manner (to maybe 10% of the screen size). The relheight parameter works with buttons, but it doesn't seem to work with the slider.

0

There are 0 answers