Jul-20-2019, 05:51 AM
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"....
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