cell height now dynamic in tables
Python CI / test (3.10) (push) Successful in 2m16s
Python CI / test (3.12) (push) Successful in 2m8s
Python CI / test (3.13) (push) Successful in 2m2s

This commit is contained in:
2025-11-10 22:06:05 +01:00
parent 41dc904755
commit 9de67d958e
11 changed files with 322 additions and 62 deletions
+73 -29
View File
@@ -68,10 +68,10 @@ Demonstrates:
![Table Rendering Example](../docs/images/example_04_table_rendering.png)
### 05. Tables with Images
**`05_table_with_images.py`** - Tables containing images and mixed content
**`05_html_table_with_images.py`** - Tables containing images and mixed content
```bash
python 05_table_with_images.py
python 05_html_table_with_images.py
```
Demonstrates:
@@ -80,8 +80,9 @@ Demonstrates:
- Book catalog and product showcase tables
- Mixed content (images and text) in cells
- Using cover images from test data
- HTML table parsing with `<img>` tags
![Table with Images Example](../docs/images/example_05_table_with_images.png)
![Table with Images Example](../docs/images/example_05_html_table_with_images.png)
### 06. Functional Elements (Interactive)
**`06_functional_elements_demo.py`** - Interactive buttons and forms with callbacks
@@ -101,13 +102,47 @@ Demonstrates:
![Functional Elements Example](../docs/images/example_06_functional_elements.png)
### 07. Button Pressed States (Interactive)
**`07_pressed_state_demo.py`** - Visual feedback for button interactions
```bash
python 07_pressed_state_demo.py
```
Demonstrates:
- Button pressed/released state management
- Visual feedback timing (150ms press duration)
- Automatic interaction handling with `InteractionHandler`
- Manual state management for custom event loops
- Dirty flag system for optimized re-rendering
- State tracking with `InteractionStateManager`
![Button Pressed State Animation](../docs/images/example_07_button_animation.gif)
*Animated GIF showing button press sequence: initial → pressed → released*
---
## 🆕 New Examples (2024-11)
These examples address critical coverage gaps and demonstrate advanced features:
### 08. Pagination with PageBreak (NEW) ✅
### 08. Bundled Fonts Showcase
**`08_bundled_fonts_demo.py`** - Demonstration of all bundled fonts
```bash
python 08_bundled_fonts_demo.py
```
Demonstrates:
- DejaVu Sans (Sans-serif)
- DejaVu Serif (Serif)
- DejaVu Sans Mono (Monospace)
- All font variants: Regular, Bold, Italic, Bold Italic
![Bundled Fonts Example](../docs/images/demo_08_bundled_fonts.png)
### 08. Pagination with PageBreak ✅
**`08_pagination_demo.py`** - Multi-page documents with explicit and automatic pagination
```bash
@@ -201,18 +236,6 @@ Demonstrates:
---
## Advanced Examples
### HTML Rendering
These examples demonstrate rendering HTML content to multi-page layouts:
**`html_line_breaking_demo.py`** - Basic HTML line breaking demonstration
**`html_multipage_simple.py`** - Simple single-page HTML rendering
**`html_multipage_demo_final.py`** - Complete multi-page HTML rendering with headers/footers
For detailed information about HTML rendering, see `README_HTML_MULTIPAGE.md`.
## Running the Examples
All examples can be run directly from the examples directory:
@@ -220,24 +243,45 @@ All examples can be run directly from the examples directory:
```bash
cd examples
# Getting Started
python 01_simple_page_rendering.py
python 02_text_and_layout.py
python 03_page_layouts.py
python 04_table_rendering.py
python 05_table_with_images.py
python 06_functional_elements_demo.py
# Getting Started (01-07)
python 01_simple_page_rendering.py # Page layouts
python 02_text_and_layout.py # Text alignment with justified text
python 03_page_layouts.py # Various page sizes
python 04_table_rendering.py # Table styles
python 05_html_table_with_images.py # HTML tables with images
python 06_functional_elements_demo.py # Interactive buttons and forms
python 07_pressed_state_demo.py # Button pressed states (generates GIF)
# NEW: Advanced Features
python 08_pagination_demo.py # Multi-page documents
python 09_link_navigation_demo.py # All link types
python 10_forms_demo.py # All form field types
python 11_table_text_wrapping_demo.py # Table cell text wrapping
python 11b_simple_table_wrapping.py # Simple wrapping demo
# Advanced Features (08-11)
python 08_bundled_fonts_demo.py # Bundled font showcase
python 08_pagination_demo.py # Multi-page documents
python 09_link_navigation_demo.py # All link types
python 10_forms_demo.py # All form field types
python 11_table_text_wrapping_demo.py # Table text wrapping
python 11b_simple_table_wrapping.py # Simple wrapping demo
```
Output images are saved to the `docs/images/` directory.
## Recent Improvements
### ✅ Justified Text Fix (2024-11-10)
Lines using justified alignment now properly fill the entire width by:
- Calculating base spacing and remainder pixels
- Distributing remainder across word gaps to eliminate short lines
- Removing max_spacing constraint for true justification
**Affected examples:** 02, 11, 11b - All text now perfectly justified!
### ✅ Animated Button States (2024-11-10)
Example 07 now automatically generates an animated GIF showing button interactions:
- Initial state (1000ms)
- Pressed state (200ms)
- Released state (500ms)
- Loops continuously
**Output:** `docs/images/example_07_button_animation.gif`
### Running Tests
All new examples (08, 09, 10) include comprehensive test coverage: