O'Reilly logo

Python 2.6 Graphics Cookbook by Mike Ohlson de Fine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Custom DIY controller widgets

We construct our own widget from basic graphic elements on a canvas. The existing slide control widget available from Tkinter looks a bit large and cumbersome sometimes. If we need a more neat and compact slide-type user input device we can manufacture our own.

The choice made here is to assemble the essential slider functions as graphic and text elements on a Tkinter canvas.

Custom DIY controller widgets

How to do it...

What we see in the following code are three similar groups of code separated by double lines and a callback function that focuses on one of the three segments depending on the value of a variable named focus_flag. Execute the program ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required