Scrollable frame widget for Tkinter
Project description
**tkScrolledFrame** is a scrollable frame widget for Python + Tkinter.
## Usage
tkScrolledFrame consists of a single module, `tkscrolledframe` (note the module name is lowercase), which exports a single class, `ScrolledFrame`.
A brief example program:
```python
#!/usr/bin/env python
# This assumes Python 3
from tkinter import *
from tkscrolledframe import ScrolledFrame
# Create a root window
root = Tk()
# Create a ScrolledFrame widget
sf = ScrolledFrame(root, width=640, height=480)
sf.pack(side="top", expand=1, fill="both")
# Bind the arrow keys and scroll wheel
sf.bind_arrow_keys(root)
sf.bind_scroll_wheel(root)
# Create a frame within the ScrolledFrame
inner_frame = sf.display_widget(Frame)
# Add a bunch of widgets to fill some space
num_rows = 16
num_cols = 16
for row in range(num_rows):
for column in range(num_cols):
w = Label(inner_frame,
width=15,
height=5,
borderwidth=2,
relief="groove",
anchor="center",
justify="center",
text=str(row * num_cols + column))
w.grid(row=row,
column=column,
padx=4,
pady=4)
# Start Tk's event loop
root.mainloop()
```
For detailed documentation, try `python -m pydoc tkscrolledframe`.
## Usage
tkScrolledFrame consists of a single module, `tkscrolledframe` (note the module name is lowercase), which exports a single class, `ScrolledFrame`.
A brief example program:
```python
#!/usr/bin/env python
# This assumes Python 3
from tkinter import *
from tkscrolledframe import ScrolledFrame
# Create a root window
root = Tk()
# Create a ScrolledFrame widget
sf = ScrolledFrame(root, width=640, height=480)
sf.pack(side="top", expand=1, fill="both")
# Bind the arrow keys and scroll wheel
sf.bind_arrow_keys(root)
sf.bind_scroll_wheel(root)
# Create a frame within the ScrolledFrame
inner_frame = sf.display_widget(Frame)
# Add a bunch of widgets to fill some space
num_rows = 16
num_cols = 16
for row in range(num_rows):
for column in range(num_cols):
w = Label(inner_frame,
width=15,
height=5,
borderwidth=2,
relief="groove",
anchor="center",
justify="center",
text=str(row * num_cols + column))
w.grid(row=row,
column=column,
padx=4,
pady=4)
# Start Tk's event loop
root.mainloop()
```
For detailed documentation, try `python -m pydoc tkscrolledframe`.
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
tkScrolledFrame-1.0.1.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file tkScrolledFrame-1.0.1.tar.gz
.
File metadata
- Download URL: tkScrolledFrame-1.0.1.tar.gz
- Upload date:
- Size: 5.1 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 | b20ed1e4649ee61876cf7032d0ab9e19b9466d7d9762bfd5ec669da3b7c06072 |
|
MD5 | 22511e12d0b077f58e05a3b9213eef10 |
|
BLAKE2b-256 | e1f7a5d32dea7fe38eef3ea7f02e5f40eba5b53878bf0372b6692529aac7b3fd |
File details
Details for the file tkScrolledFrame-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: tkScrolledFrame-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 7.5 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 | 802e352065ab67d271d0d0360bf4d5806b831689ff75a1b34394ec5cd65b8a93 |
|
MD5 | 24c7362ea90e54912dcc83b28a5ca1c1 |
|
BLAKE2b-256 | ba339e41b1f0760bcc70f3f7864b9c1bc64826ccb5940e56b6396b0f345ebd57 |