Tabular data display widget for Tkinter
Project description
**tkDataCanvas** is a tabular data display widget for Python + Tkinter. It is intended as a more efficient replacement for [tkMagicGrid](https://github.com/bmjcode/tkMagicGrid) and [tkScrolledFrame](https://github.com/bmjcode/tkScrolledFrame) for displaying large amounts of static data.
tkDataCanvas is designed to be simple above all else. It has no dependencies outside the Python standard library. Its API is designed to let you accomplish tasks with as few method calls as possible.
Both Python 2 and 3 are supported, on Windows and Unix platforms.
## Usage
tkDataCanvas consists of a single module, `tkdatacanvas` (note the module name is lowercase), which exports a single class, `DataCanvas`.
A brief example program:
```python
# This assumes Python 3
from tkinter import *
from tkdatacanvas import DataCanvas
import io
import csv
# Create a root window
root = Tk()
# Create a DataCanvas widget
dc = DataCanvas(root)
dc.pack(side="top", expand=1, fill="both")
# Display the contents of some CSV file
with io.open("test.csv", "r", newline="") as csv_file:
reader = csv.reader(csv_file)
parsed_rows = 0
for row in reader:
if parsed_rows == 0:
# Display the first row as a header
dc.add_header(*row)
else:
dc.add_row(*row)
parsed_rows += 1
dc.display()
# Start Tk's event loop
root.mainloop()
```
For detailed documentation, try `python -m pydoc tkdatacanvas`.
tkDataCanvas is designed to be simple above all else. It has no dependencies outside the Python standard library. Its API is designed to let you accomplish tasks with as few method calls as possible.
Both Python 2 and 3 are supported, on Windows and Unix platforms.
## Usage
tkDataCanvas consists of a single module, `tkdatacanvas` (note the module name is lowercase), which exports a single class, `DataCanvas`.
A brief example program:
```python
# This assumes Python 3
from tkinter import *
from tkdatacanvas import DataCanvas
import io
import csv
# Create a root window
root = Tk()
# Create a DataCanvas widget
dc = DataCanvas(root)
dc.pack(side="top", expand=1, fill="both")
# Display the contents of some CSV file
with io.open("test.csv", "r", newline="") as csv_file:
reader = csv.reader(csv_file)
parsed_rows = 0
for row in reader:
if parsed_rows == 0:
# Display the first row as a header
dc.add_header(*row)
else:
dc.add_row(*row)
parsed_rows += 1
dc.display()
# Start Tk's event loop
root.mainloop()
```
For detailed documentation, try `python -m pydoc tkdatacanvas`.
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
tkDataCanvas-0.1.0.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file tkDataCanvas-0.1.0.tar.gz
.
File metadata
- Download URL: tkDataCanvas-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d89719d128e3e31af0f5835cf8d04a587be348a30f592910b5f5c0ba71ee41b |
|
MD5 | 83beb0903fec3433831cf281fe847e41 |
|
BLAKE2b-256 | e3baa9284a6af051a109357d445eb831c2101f4534a9b2835c3f4a2cf3b6a447 |
File details
Details for the file tkDataCanvas-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: tkDataCanvas-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1697b4dff43c403d784d51b0b9aeea44e469ce01c4f6cdf92f8474d57515992 |
|
MD5 | e8d76fa0811a8d30d9d5e9999c38ca28 |
|
BLAKE2b-256 | 088077c1373e36450672938cf46de464b0efa6ed9dc0888f9119106e3d1b5b85 |