Skip to main content

tkMagicGrid is a table layout widget for Python + Tkinter. It can be used to display static data, or to lay out other widgets as an alternative to calling grid() manually, or to do a bit of both.

tkMagicGrid 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.

tkMagicGrid is not designed to be erasable. The recommended way to clear a MagicGrid widget is to destroy it and create a new one.

Both Python 2 and 3 are supported, on Windows and Unix platforms.

Usage

tkMagicGrid consists of a single module, tkmagicgrid (note the module name is lowercase), which exports a single class, MagicGrid.

A brief example program:

#!/usr/bin/env python3

from tkinter import *
from tkmagicgrid import *
import io
import csv

# Create a root window
root = Tk()

# Create a MagicGrid widget
grid = MagicGrid(root)
grid.pack(side="top", expand=1, fill="both")

# Display the contents of some CSV file
# (note this is not a particularly efficient viewer)
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
    	    grid.add_header(*row)
        else:
    	    grid.add_row(*row)
        parsed_rows += 1

# Start Tk's event loop
root.mainloop()

For detailed documentation, try python -m pydoc tkmagicgrid.

Related Modules

tkScrolledFrame provides an easy way to make a MagicGrid (and other large widgets) scrollable.

Release files for tkMagicGrid 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tkMagicGrid 1.0.3
File Size Uploaded
tkMagicGrid-1.0.3.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tkMagicGrid 1.0.3
File Interpreter ABI Platform
tkMagicGrid-1.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 19.6 kB

Release files / tkMagicGrid-1.0.3.tar.gz

Download URL tkMagicGrid-1.0.3.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
78f77fc461dbd1de6bb51081088ca08e427f740ac74a21fd96e238fe1041085e
BLAKE2b-256 checksum
How to use checksums
245ce3a5f8452002da5f3eaf80aa14dbea574f47f531cc7128682303b139538a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

Release files / tkMagicGrid-1.0.3-py2.py3-none-any.whl

Download URL tkMagicGrid-1.0.3-py2.py3-none-any.whl
Size 10.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
972cc46c59c3dbd10f7021335185bd57ef64924695a0a5bb03d2d89f5d2ce1e7
BLAKE2b-256 checksum
How to use checksums
9fa43ba7d8ed3b8fe8d959019b20f03a8fc8bb335c0bb99af8d021d364e5d4da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page