A lightweight Python library for creating animated, live-updating line charts natively in Tkinter — no matplotlib required.
Project description
🎥 Watch the Main Demo Video on GitHub
✨ Features
| Feature | Description |
|---|---|
| ⚡ Live Updates | Stream and display real-time data continuously |
| 📉 Multiple Lines | Plot several lines on the same chart for easy comparison |
| 🎨 Color Customization | Tailor colors to match your app's design |
| 🔤 Font Customization | Adjust text fonts for better readability |
| 📐 Dimension Control | Resize charts to fit any layout |
| 🎛️ Granular Config | Fine-grained control via configure_*() methods (v2.2.0+) |
📦 Installation
pip install tkchart
import tkchart
🚀 Quick Start
import tkinter as tk
import tkchart
import random
import threading
import time
root = tk.Tk()
# 1. Create the chart
chart = tkchart.LineChart(
master=root,
x_axis_values=("a", "b", "c", "d", "e", "f"),
y_axis_values=(100, 900)
)
chart.place(x=10, y=10)
# 2. Create a line
line = tkchart.Line(master=chart)
# 3. Stream data in a background thread
def loop():
while True:
chart.show_data(line=line, data=[random.choice(range(100, 900))])
time.sleep(1)
threading.Thread(target=loop, daemon=True).start()
root.mainloop()
🎬 Live Examples
1 — Simple
▶️ View Simple Demo Video on GitHub
View code
import tkinter as tk
import tkchart
import random
import threading
import time
root = tk.Tk()
root.configure(bg="#0d1117")
root.geometry("720x430+200+200")
line_chart = tkchart.LineChart(
master=root,
x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
y_axis_values=(0, 1000)
)
line_chart.pack(pady=15)
line = tkchart.Line(master=line_chart)
def display_data():
while True:
line_chart.show_data(line=line, data=[random.choice(range(0, 1000))])
time.sleep(0.5)
threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
2 — Styled & Filled Line
▶️ View Styled & Filled Line Demo Video on GitHub
View code
import tkinter as tk
import tkchart
import random
import threading
import time
root = tk.Tk()
root.configure(bg="#0d1117")
root.geometry("720x430+200+200")
line_chart = tkchart.LineChart(
master=root,
x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
y_axis_values=(0, 1000),
y_axis_label_count=10,
)
line_chart.pack(pady=15)
line = tkchart.Line(
master=line_chart,
size=2,
fill="enabled"
)
def display_data():
while True:
line_chart.show_data(line=line, data=[random.choice(range(0, 1000))])
time.sleep(0.5)
threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
3 — 2 Lines with Different Styles
▶️ View 2 Lines Demo Video on GitHub
View code
import tkinter as tk
import tkchart
import random
import threading
import time
root = tk.Tk()
root.configure(bg="#0d1117")
root.geometry("720x430+200+200")
line_chart = tkchart.LineChart(
master=root,
x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
y_axis_values=(0, 1000),
y_axis_label_count=10,
)
line_chart.pack(pady=15)
line1 = tkchart.Line(
master=line_chart,
color="#5dffb6",
size=2,
style="dashed",
style_type=(10, 5),
)
line2 = tkchart.Line(
master=line_chart,
color="#FFBAD2",
size=2,
point_highlight="enabled",
point_highlight_color="#FFBAD2",
)
def display_data():
while True:
line_chart.show_data(line=line1, data=[random.choice(range(0, 1000))])
line_chart.show_data(line=line2, data=[random.choice(range(0, 1000))])
time.sleep(0.5)
threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
4 — 3 Lines with Different Styles
▶️ View 3 Lines Demo Video on GitHub
View code
import tkinter as tk
import tkchart
import random
import threading
import time
root = tk.Tk()
root.configure(bg="#0d1117")
root.geometry("720x430+200+200")
line_chart = tkchart.LineChart(
master=root,
x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
y_axis_values=(0, 1000),
y_axis_label_count=10,
)
line_chart.pack(pady=15)
line1 = tkchart.Line(master=line_chart, size=2, fill="enabled")
line2 = tkchart.Line(
master=line_chart,
color="#5dffb6",
size=2,
style="dashed",
style_type=(10, 5),
)
line3 = tkchart.Line(
master=line_chart,
color="#FFBAD2",
size=2,
point_highlight="enabled",
point_highlight_color="#FFBAD2",
)
def display_data():
while True:
line_chart.show_data(line=line1, data=random.choices(range(0, 1000), k=1))
line_chart.show_data(line=line2, data=random.choices(range(0, 1000), k=1))
line_chart.show_data(line=line3, data=random.choices(range(0, 1000), k=1))
time.sleep(0.5)
threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
5 — With Grid Sections
▶️ View Grid Sections Demo Video on GitHub
View code
import tkinter as tk
import tkchart
import random
import threading
import time
root = tk.Tk()
root.configure(bg="#0d1117")
root.geometry("720x430+200+200")
line_chart = tkchart.LineChart(
master=root,
x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
y_axis_values=(0, 1000),
y_axis_label_count=10,
y_axis_section_count=10,
x_axis_section_count=10,
)
line_chart.pack(pady=15)
line1 = tkchart.Line(
master=line_chart,
color="#5dffb6",
size=2,
style="dashed",
style_type=(10, 5),
)
line2 = tkchart.Line(
master=line_chart,
color="#FFBAD2",
size=2,
point_highlight="enabled",
point_highlight_color="#FFBAD2",
)
def display_data():
while True:
line_chart.show_data(line=line1, data=[random.choice(range(0, 1000))])
line_chart.show_data(line=line2, data=[random.choice(range(0, 1000))])
time.sleep(0.5)
threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
📚 Documentation
Explore all parameters, configuration methods, and advanced usage:
👥 Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tkchart-2.2.0.tar.gz.
File metadata
- Download URL: tkchart-2.2.0.tar.gz
- Upload date:
- Size: 35.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ed50bf6bb1fbf0049fc1f14634b58dcabe1b68dd1e7240c619bff5690b12e71
|
|
| MD5 |
16d668fff16a5f5b63b6ad90cda1aac6
|
|
| BLAKE2b-256 |
2eaf068623bcb0fc1d047f95ae97ec3333cd6c37d16ecb01f220d2cd53bc0ee7
|
File details
Details for the file tkchart-2.2.0-py3-none-any.whl.
File metadata
- Download URL: tkchart-2.2.0-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
268e10f8a4c4a68e052d2d039aae76565e34f288a74faa4bc2190c175214b4ff
|
|
| MD5 |
0c3f7d86f92acb27d0a73ab765f55e4b
|
|
| BLAKE2b-256 |
e23507725ab9728b9c9b448fcd81cbbd75a7c172e4f35642c06502a830b73510
|