tkchart is a Python library for creating live updating line charts in Tkinter.
Project description
Features
- Live Update: Display live data with line charts.
- Multiple Lines: Support for plotting multiple lines on the same chart for easy comparison.
- Color Customization: Customize colors to match your application's design or data representation.
- Font Customization: Adjust fonts for text elements to enhance readability.
- Dimension Customization: Customize chart dimensions to fit various display sizes and layouts.
Importing & Installation
-
Installation
pip install tkchart
-
Importing
import tkchart
Simple Guide
-
import package
import tkchart
-
Create Line Chart and place 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)
-
Create Line
line = tkchart.Line(master=chart)
-
Display Data display data using a loop
def loop(): while True: random_data = random.choice(range(100, 900)) chart.show_data(line=line, data=[random_data]) time.sleep(1) #call the loop as thead theading.Thread(target=loop).start()
Full Code Example
import tkchart # <- import the package
import tkinter
import random
import threading
import time
#create window
root = tkinter.Tk()
#create 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) #place chrt
#create line
line = tkchart.Line(master=chart)
def loop():
while True:
random_data = random.choice(range(100, 900)) #get random data
chart.show_data(line=line, data=[random_data]) # <- display data using chart
time.sleep(1) #wait 1 sec
#call the loop as thead
threading.Thread(target=loop).start()
root.mainloop()
Links
- Documentation
- GitHub Repository : tkchart
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
tkchart-2.1.4.tar.gz
(24.8 kB
view details)
Built Distribution
tkchart-2.1.4-py3-none-any.whl
(24.1 kB
view details)
File details
Details for the file tkchart-2.1.4.tar.gz
.
File metadata
- Download URL: tkchart-2.1.4.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5937027b4240d4c7ac868b2e3c8c1464b678042181e3f756810ae50c323c6bfa |
|
MD5 | 10920c5352546d7d20d4d3efc0ef2a12 |
|
BLAKE2b-256 | 975eb99d214b9950b993da047ac6f6278c14445dafa1424a02c334d6a6dee409 |
File details
Details for the file tkchart-2.1.4-py3-none-any.whl
.
File metadata
- Download URL: tkchart-2.1.4-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3c8328fc2c78a0d1c2c91f445cc00737169fba84d6922078755fe456798b344 |
|
MD5 | 1da295a6ed70a97a42dc2b9c0e3d0aa8 |
|
BLAKE2b-256 | 8a243990c27fa888ab1f52d7dadb3a76988e79e11459692db0f84d82ccab098b |