April 2018
Beginner
340 pages
7h 54m
English
The Spinbox widget is a widget that allows the programmer to set specified values, either as a single tuple of choices or two keyword arguments that specify the beginning and end of a range.
Since we want to force the font size to be an integer, and we can assume that nobody will want a font size under 5 or over 99, we can use these things to form our Spinbox:
self.size_input = tk.Spinbox(self, from_=5, to=99, value=self.master.font_size)
We create a Spinbox widget, passing the parent widget as normal.
The from_ keyword argument is used to specify the minimum selectable value. The argument requires a trailing underscore because the word from is a keyword in Python. Likewise, the to argument specifies the maximum value. ...