O'Reilly logo

Tkinter GUI Application Development Blueprints - Second Edition by Bhaskar Chaudhary

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

Drawing super shapes

We call these shapes super shapes because we can build many interesting shapes using a single mathematical formula called Super Formula. See https://en.wikipedia.org/wiki/Superformula for more details on the formula.

The super formula takes six input arguments: a, b, m, n1, n2, and n3. Varying these five arguments produces varied shapes found in nature such as the shapes of shells, starfish, flowers, and more.

We do not get into why or how this formula works. All we do is write a method that, given these five arguments, returns the coordinates for unique shapes. We then pass these coordinates to our create_polygon method to create these shapes on the canvas. The method that returns these points is defined as follows (see ...

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