Fast, GPU-painted spreadsheet grid for tens of thousands of rows (Windows, Direct2D).
Project description
A GPU-painted spreadsheet grid for tens of thousands of rows. Only visible cells are built, so scroll, select, filter and find stay instant. A GUI-free core holds the logic. One Direct2D engine draws it, under a thin Tk or Qt host.
Requirements
| Requirement | Details |
|---|---|
| Windows only | The renderer is Direct2D (core/surface.dll): needs Windows and a Direct3D 11 GPU (falls back to the WARP software device if there's none). No macOS/Linux backend. |
| Python 3.8+ | |
| Tk host | Standard library only (tkinter). |
| Qt host | Needs PySide6 (pip install PySide6), the only dependency, and only for the Qt host. |
| Native DLLs | The wheel bundles two compiled DLLs. surface.dll draws the Direct2D surface and gridcore.dll is an optional C++ data core (falls back to pure Python if missing). Building them from source needs CMake + MSVC. |
Install
pip install fastpygrid # Tk host (stdlib only)
pip install fastpygrid PySide6 # add the Qt host
Example
Tk
from fastpygrid.render.tk import make_sheet # tkinter host (stdlib only)
win = make_sheet(
["Ticker", "Company", "Sector", "Price"],
[["AAPL", "Apple Inc.", "Technology", "189.20"],
["XOM", "Exxon Mobil", "Energy", "104.10"]],
frozen_columns=2, # pin the first 2 columns against horizontal scroll
)
win.mainloop()
Qt
from fastpygrid.render.qt import make_sheet # PySide6 host
win = make_sheet(headers, rows, frozen_columns=2)
win.mainloop() # aliases app.exec()
Interface
The library is two things: make_sheet(), which opens a window, and the
GridModel it returns, which you call to style cells, add dropdowns or draw
dividers. Both hosts (fastpygrid.render.tk and fastpygrid.render.qt) expose
the same make_sheet.
Coordinates: col is a 0-based column index. gr is a grid row, where rows
0 .. header_rows-1 are the header and everything from header_rows on is data.
With one header row, the first data row is gr=1. You never touch pixels.
make_sheet(headers, rows, ...)
Builds the model, opens the window, returns it. Raises RuntimeError if the
Direct2D surface can't be created (DLL missing or no D3D device).
| Argument | Type | Default | What it does |
|---|---|---|---|
headers |
list[str] or list[list[str]] |
required | Column titles. A list of lists gives stacked headers, where adjacent equal labels in the upper rows merge into group bands. |
rows |
list[list] |
required | The data, row by row. Values are stringified. |
frozen_columns |
int |
0 |
Pin this many leading columns against horizontal scroll. |
view_only |
bool |
False |
Read-only sheet: no edit, paste or delete. |
master |
widget | None |
Parent window. Given one, opens as a child instead of a new top-level app. |
col_w |
list[int] |
None |
Per-column pixel widths. None auto-sizes. |
title |
str |
host default | Window title. |
uncap_rows |
bool |
False |
Lift the built-in row-count cap. |
uncap_cols |
bool |
False |
Lift the built-in column-count cap. |
Returns the host window: a tk.Tk (or Toplevel) for Tk, a QWidget for Qt.
Both carry .mainloop() (Qt aliases app.exec()), .model (the GridModel),
and .grid_view (the grid widget).
from fastpygrid.render.tk import make_sheet
win = make_sheet(
["Ticker", "Company", "Sector", "Price"],
[["AAPL", "Apple Inc.", "Technology", "189.20"],
["XOM", "Exxon Mobil", "Energy", "104.10"]],
frozen_columns=2,
)
win.mainloop()
Reading and writing cells
Reach the model through win.model.
| Call | Returns | What it does |
|---|---|---|
cell(gr, col) |
str |
Text at that grid row/column ("" if out of range). |
nrows() |
int |
Total grid rows: header rows plus data. |
ncols |
int |
Column count (a property, no parens). |
set_cell(gr, col, text) |
bool |
Write a cell. Goes through undo. Returns False if unchanged or read-only. |
set_data(headers, rows) |
None |
Swap in a new sheet, resetting filters, sort and undo. |
m = win.model
m.cell(1, 0) # 'AAPL'
m.set_cell(1, 3, "191.55") # bump Apple's price, returns True
m.ncols # 4
Styling and dropdowns
Styles and choices are keyed to the data, so they follow a row through sort and filter.
| Call | What it does |
|---|---|
set_cell_style(gr, col, fg=None, bg=None, bold=None) |
Style one cell. fg/bg are #rrggbb. None leaves an attribute as-is. |
set_cell_choices(gr, col, choices) |
Turn one cell into a dropdown offering choices. None clears it. |
set_col_choices(col, choices) |
Same for a whole column, one O(1) call. A per-cell choice overrides it. |
m.set_cell_style(1, 3, fg="#c0392b", bold=True) # Apple's price in bold red
m.set_col_choices(2, ["Technology", "Energy", "Healthcare"]) # Sector is a dropdown
Dividers and locked cells
Dividers are positional (keyed by index), so they stay put when data moves. Read-only rows are keyed to the data and follow it.
| Call | What it does |
|---|---|
set_vline(col, on=True) |
Thick black rule on the right edge of a column. |
set_hline(gr, on=True) |
Thick black rule on the bottom edge of a grid row. |
set_readonly_col(col, on=True) |
Block edit/paste/delete in a column (still selectable and copyable). |
set_readonly_row(gr, on=True) |
Same, for a row. |
m.set_vline(1) # rule after the 'Company' column
m.set_hline(0) # rule under the header
m.set_readonly_col(0) # Ticker can't be edited
Build
build.bat
Runs python -m build, which drives CMake to compile the DLLs and produce
dist/fastpygrid-*.whl + .tar.gz (same artifacts as CI/PyPI). Needs CMake,
MSVC, and Python's build. Re-run after any .cpp/.py change.
Run demo
demos/setup.bat creates demos/.venv and installs the freshly built wheel.
Run it after build.bat, then:
demos\demo.bat tk # tkinter host, 100k rows
demos\demo.bat qt # Qt host, same data
demos\demo.bat tk --rows 500000 # stress it
demos\.venv\Scripts\python scripts/tests/check_select.py # selection-state-machine check
demos\.venv\Scripts\python scripts/tests/fuzz_coremodel.py # C++ data core vs oracle
Layout
Fast-Python-Grid/
|-- fastpygrid/ # the python package
| |-- core/ # model, geometry, selection, paint() -> display list, gpu.py (Direct2D engine)
| | # surface.dll + gridcore.dll compile in here, beside their loaders (not committed)
| |-- render/ # tk.py (tkinter host), qt.py (PySide6 host)
| `-- csrc/ # C++ sources: surface.cpp, gridcore.cpp
|-- CMakeLists.txt # compiles the DLLs (scikit-build-core)
|-- build.bat # python -m build -> dist/*.whl + *.tar.gz (same as CI/PyPI)
|-- demos/ # demo_gpu_tk.py, demo_gpu_qt.py, _data.py, setup.bat (wheel into demos/.venv)
`-- scripts/
|-- tests/ # check_select.py, fuzz_coremodel.py (need fastpygrid installed)
`-- benchmarks/ # bench_geometry.py (need fastpygrid installed)
Project details
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 fastpygrid-0.1.2.tar.gz.
File metadata
- Download URL: fastpygrid-0.1.2.tar.gz
- Upload date:
- Size: 348.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66920544bebc32b82bf51e8e2e89ade572348536a2bc2af7426e0030489e440c
|
|
| MD5 |
6d03b3983ffc6af4352571ecb7988a51
|
|
| BLAKE2b-256 |
775faf20b5dbf5f10ac3e7f89f2d1ea86d87bea1b3c026f3b8e30392107c61a5
|
Provenance
The following attestation bundles were made for fastpygrid-0.1.2.tar.gz:
Publisher:
publish.yml on flynncrochon/Fast-Python-Grid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastpygrid-0.1.2.tar.gz -
Subject digest:
66920544bebc32b82bf51e8e2e89ade572348536a2bc2af7426e0030489e440c - Sigstore transparency entry: 2143082332
- Sigstore integration time:
-
Permalink:
flynncrochon/Fast-Python-Grid@9147a0ffdfb3f551d642537cebe09c72e3a798dd -
Branch / Tag:
refs/tags/v0.01.2 - Owner: https://github.com/flynncrochon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9147a0ffdfb3f551d642537cebe09c72e3a798dd -
Trigger Event:
release
-
Statement type:
File details
Details for the file fastpygrid-0.1.2-py3-none-win_amd64.whl.
File metadata
- Download URL: fastpygrid-0.1.2-py3-none-win_amd64.whl
- Upload date:
- Size: 106.7 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e82248196b9bbbc1708038221dd35ba6af18fba3d48610cb309281895bef290
|
|
| MD5 |
109b8216c61611822727951bd2b2a624
|
|
| BLAKE2b-256 |
ae2180ef122bd228a08f715f25a4c97e86d5dcb43d0ca2c2897116a107496b70
|
Provenance
The following attestation bundles were made for fastpygrid-0.1.2-py3-none-win_amd64.whl:
Publisher:
publish.yml on flynncrochon/Fast-Python-Grid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastpygrid-0.1.2-py3-none-win_amd64.whl -
Subject digest:
5e82248196b9bbbc1708038221dd35ba6af18fba3d48610cb309281895bef290 - Sigstore transparency entry: 2143082347
- Sigstore integration time:
-
Permalink:
flynncrochon/Fast-Python-Grid@9147a0ffdfb3f551d642537cebe09c72e3a798dd -
Branch / Tag:
refs/tags/v0.01.2 - Owner: https://github.com/flynncrochon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9147a0ffdfb3f551d642537cebe09c72e3a798dd -
Trigger Event:
release
-
Statement type: