[Tkinter] Scale at the Top - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] Scale at the Top (/thread-19921.html) |
Scale at the Top - Friend - Jul-20-2019 Hello all, i am a newbie in GUI/Tkinter. I was trying an example of Scale (from 4 to 50)from a book. It works almost fine, however when i start the GUI, the scale is at the top showing '4'. so to scale the letter 'A', i have to move the scale downwards. Can someone please tell what is missing here ? 2.Question, what is that parameter "event" in the function setSize()...removing it create the following error : "setSize() takes 1 positional argument but 2 were given" i don't know how "Scale" uses the function "setSize".... from tkinter import * class Regler: def __init__(self): self.root = Tk() self.label = Label(self.root, text='A', font=('Arial',4)) self.scale = Scale(self.root, length='3c', from_=4, to=50, command=self.setSize) self.label.pack(side = LEFT) self.scale.pack(side = RIGHT) self.root.mainloop() def setSize(self, event): x = int(self.scale.get()) self.label.config(font=('Arial',x)) regler = Regler()Thanks in advance RE: Scale at the Top - Yoriz - Jul-20-2019
RE: Scale at the Top - Friend - Jul-20-2019 (Jul-20-2019, 11:49 AM)Yoriz Wrote: If you want the scale to start at a different value use its set method good to know, but that won't solve my problem. my scale is from 4 to 50. And to go from 4 to 50 i have to scrole down (Top = 4, bottom = 50)... i want it to be opposite. i hope you understand what i mean RE: Scale at the Top - Yoriz - Jul-20-2019 Switch the from_ & to values, then dragging the slider upwards will increase the value.self.scale = Scale(self.root, length='3c', from_=50, to=4, command=self.setSize) RE: Scale at the Top - Friend - Jul-20-2019 it works thanks but why is it like that...it is a bug ? i expect from_ = min ....to = max...to be the default... RE: Scale at the Top - Yoriz - Jul-20-2019 I guess the creator of tkinter thought someone would like the scale widget to be able to increase in value in both directions. Its not a bug its a feature, just like you can make a range go up or down. |