Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Tkinter GUI Application Development Blueprints

You're reading from   Tkinter GUI Application Development Blueprints Master GUI programming in Tkinter as you design, implement, and deliver 10 real-world applications

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher Packt
ISBN-13 9781785889738
Length 340 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Bhaskar Chaudhary Bhaskar Chaudhary
Author Profile Icon Bhaskar Chaudhary
Bhaskar Chaudhary
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Meet Tkinter FREE CHAPTER 2. Making a Text Editor 3. Programmable Drum Machine 4. A Game of Chess 5. Building an Audio Player 6. Paint Application 7. Multiple Fun Projects 8. Miscellaneous Tips Index

Graphing with Tkinter


Tkinter is not a graphing tool. However, should you need to draw graphs with Tkinter, you can use the Canvas widget to draw graphs.

In this iteration, we will draw the following graphs:

  • Pie chart (7.13_pie_chart.py)

  • Bar graph ( 7.14_bar_graph.py)

  • Scatter plot (7.15_scatter_plot.py)

The three graphs show up as follows:

Let's look at the pie chart first. You can easily create a pie chart in Tkinter using the Canvas widget's create_arc method.

The create_arc method has the following signature:

item_id = canvas.create_arc(x1, y1, x2, y2, option, ...)

Point (x1, y1) is the top-left corner and point (x2, y2) is the bottom-right corner of the rectangle into which the arc fits. If the bounding rectangle is a square, it makes a circle. The method also takes two arguments named start and extent that we will use to create the pie chart.

The start option specifies the start angle for the arc, measured in degrees from the +x direction. When omitted, you get the complete ellipse. The extent...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image