Tkinter GUI Application Development Blueprints, Second Edition - Second Edition
by Bhaskar Chaudhary
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 ...
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.
Read now
Unlock full access