How it works...

Note how, in the first screenshot, our new Spinbox control defaulted to a width of 20, pushing out the column width of all controls in this column. This is not what we want.

We gave the widget a range from 0 to 10. 

In the second screenshot, we reduced the width of the Spinbox control, which aligned it in the center of the column.

In the third screenshot, we added the borderwidth property of the Spinbox, which automatically made the entire Spinbox appear no longer flat, but three-dimensional.

In the fourth screenshot, we added a callback function to display the number chosen in the ScrolledText widget and print it to the standard out stream. We added  to print on new lines. Notice how the default value does not get printed. It is only when we click the control that the callback function gets called. By clicking the down arrow with a default of 0, we can print the 0 value.

Lastly, we restrict the values available to a hardcoded set. This could also be read in from a data source (for example, a text or XML file).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.237.201