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()
```
## 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()
```
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.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for tkScrolledFrame-1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bae92e064155acae01c27ba805a69a7d143593bc2a3f7d3736ea39f7cd68c28 |
|
MD5 | 110fbf8450b96aecb5442fbd776dd9ef |
|
BLAKE2b-256 | 643ce252d87085e23444fbaab1b244f2db086987cf7192d8243590243d88f7b1 |