A flet extension to render LaTex formulas
|
|
Installation
available in pypi:
pip install flet_math
- Add the dependency to your
pyproject.toml:
dependencies = [
"flet_math" # or flet_math @ git+https://github.com/Bbalduzz/flet_math.git
]
- Build with
flet build:
flet build <target> -v
Basic Usage
Here's a simple example of rendering a mathematical equation:
import flet as ft
from flet_math import Math
def main(page: ft.Page):
page.title = "Flet Math Example"
page.theme_mode = ft.ThemeMode.LIGHT
page.padding = 20
page.scroll = ft.ScrollMode.AUTO
page.add(
ft.Text("Flet Math - LaTeX Rendering", size=30, weight=ft.FontWeight.BOLD),
ft.Divider(),
ft.Text("Basic equation:", size=20),
Math(
tex=r"E = mc^2",
text_size=24,
),
)
page.update()
ft.app(target=main)
Properties
The Math control supports the following properties:
Core Properties
tex(str): The LaTeX formula to rendertext_color(ColorValue): Color of the rendered texttext_size(number): Size of the rendered textfont_family(str): Font family for the textfont_weight(FontWeight | str): Weight of the fonttext_align(TextAlign): Text alignmentselectable(bool): Whether the text can be selected
Layout Properties
cross_axis_alignment(CrossAxisAlignment): Cross-axis alignmentmain_axis_alignment(MainAxisAlignment): Main-axis alignment
Control Properties
width(number): Width of the controlheight(number): Height of the controlexpand(bool): Whether to expand to fill available spaceopacity(number): Opacity of the controltooltip(str): Tooltip textvisible(bool): Whether the control is visibledisabled(bool): Whether the control is disabled
Animation Properties
animate_opacity(bool): Animate opacity changesanimate_position(bool): Animate position changesanimate_scale(bool): Animate scale changesanimate_size(bool): Animate size changeson_animation_end(callable): Callback when animation endsrotate(number): Rotation anglescale(number): Scale factor
Metadata
Release files for flet-math 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flet_math-0.1.1.tar.gz | 11.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flet_math-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.5 kB
Release files / flet_math-0.1.1.tar.gz
| Download URL | flet_math-0.1.1.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25def6a4cef8e917615fcf466ef16263cd30389a26199f4e98f75a69f3ec868c
|
|
BLAKE2b-256 checksum How to use checksums |
e9065b80fc36af58aacbae39da6f502211ef47754ded48be152eb7a1d6503485
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.3
|
Release files / flet_math-0.1.1-py3-none-any.whl
| Download URL | flet_math-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c410f1a7dae77a13057cd1954e4a467a8e889232fa201261d8ff1b88685e9d93
|
|
BLAKE2b-256 checksum How to use checksums |
b67e1b216071c1d8c6e89486ed8692af68bdc2b5cf0f17780c30657b7df399ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.3
|