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
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.0.tar.gz
(23.9 kB
view details)
Built Distribution
tkchart-2.1.0-py3-none-any.whl
(23.2 kB
view details)
File details
Details for the file tkchart-2.1.0.tar.gz
.
File metadata
- Download URL: tkchart-2.1.0.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb92b68bed7b7e039c79a5517d2262111741dc3d971c8b0d6eb051a558ddb637 |
|
MD5 | c8fa8edafad33ee311796d876a9d00e2 |
|
BLAKE2b-256 | e86416fc39985452ec7f1ca9e14ecab98ed0f04dade6ee7caf2fb332a9dea1c0 |
Provenance
File details
Details for the file tkchart-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: tkchart-2.1.0-py3-none-any.whl
- Upload date:
- Size: 23.2 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 | 03d2b9d1d4446d3c9aacbdffdec6bb39cdd7c31b6b8355f04d4622cc584fe9b6 |
|
MD5 | 2a77dfa6b0388d507f780b97830d8dfc |
|
BLAKE2b-256 | 8b84ab9833496d9730b52f968d1ad1b5557b49829d910be76eaeeedf41c68b7d |