Skip to Content
Tkinter GUI Programming by Example
book

Tkinter GUI Programming by Example

by David Love
April 2018
Beginner content levelBeginner
340 pages
7h 54m
English
Packt Publishing
Content preview from Tkinter GUI Programming by Example

The Spinbox widget

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. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Bhaskar Chaudhary

Publisher Resources

ISBN: 9781788627481Supplemental Content