Skip to main content
**tkFilterList** is a combination of the Tkinter Listbox and Entry widgets that updates to display matching items as you type.


## Usage

tkFilterList consists of a single module, `tkfilterlist` (note the module name is lowercase), which exports a single class, `FilterList`.

A brief example program:

```python
#!/usr/bin/env python

# This assumes Python 3
from tkinter import *
from tkinter.messagebox import showinfo
from tkfilterlist import FilterList
import operator

# Source items for the FilterList
# Format: display_text, symbol, operator
source = [("Addition", "+", operator.add),
("Subtraction", "-", operator.sub),
("Multiplication", "*", operator.mul),
("Division", "/", operator.floordiv)]

# Create a root window
root = Tk()

# Create a FilterList widget
fl = FilterList(root,
source=source,
display_rule=lambda item: item[0],
filter_rule=lambda item, text:
item[0].lower().startswith(text.lower()))
fl.pack(side="top", expand=1, fill="both")

def show_result(event=None):
a, b = 42, 7
item = fl.selection()
if item:
showinfo("Result",
"{0} {1} {2} = {3}".format(a, item[1], b, item[2](a, b)),
parent=root)

# Show the result of the calculation on Return or double-click
fl.bind("<Return>", show_result)
fl.bind("<Double-Button-1>", show_result)

# Focus on the FilterList widget
fl.focus_set()

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

For detailed documentation, try `python -m pydoc tkfilterlist`.


## Customization

You can customize the item display and filtering behavior by setting its `display_rule` and `filter_rule` options, respectively, to your own custom functions:

* `display_rule(item)`: Returns the display text for the specified `item`.
* `filter_rule(item, text)`: Returns `True` if the `text` argument matches the specified `item`, `False` otherwise.

This allows tkFilterList to process lists containing complex datatypes, including other lists, tuples, and even entire classes.


Metadata

Release files for tkFilterList 0.1.0

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

Source distribution (sdist)

Source distribution for tkFilterList 0.1.0
File Size Uploaded
tkFilterList-0.1.0.tar.gz 5.9 kB Details

Built distribution (wheel)

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

Total release size: 14.7 kB

Release files / tkFilterList-0.1.0.tar.gz

Download URL tkFilterList-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0678c0d819a5030bf5d6a7d36420422b81195e0f3a1ff6d6bc301e4a4cf2ab61
BLAKE2b-256 checksum
How to use checksums
81adbbeb3a4dd437fb4cc7ab51c0de93efae2d83ee34db551ce7dfafe8fe6554
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / tkFilterList-0.1.0-py2.py3-none-any.whl

Download URL tkFilterList-0.1.0-py2.py3-none-any.whl
Size 8.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
314377641fbd91a1fbfc98653f2c9deeca694b666e82855b123ccf185c9ef12e
BLAKE2b-256 checksum
How to use checksums
9ec2e432dd120b67329dc8da37e955d51380827473aebcaed5bb8621630551bb
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

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