Skip to main content

logo

A flet extension to render LaTex formulas

logo

Installation

available in pypi:

pip install flet_math
  1. Add the dependency to your pyproject.toml:
dependencies = [
    "flet_math" # or flet_math @ git+https://github.com/Bbalduzz/flet_math.git
]
  1. 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 render
  • text_color (ColorValue): Color of the rendered text
  • text_size (number): Size of the rendered text
  • font_family (str): Font family for the text
  • font_weight (FontWeight | str): Weight of the font
  • text_align (TextAlign): Text alignment
  • selectable (bool): Whether the text can be selected

Layout Properties

  • cross_axis_alignment (CrossAxisAlignment): Cross-axis alignment
  • main_axis_alignment (MainAxisAlignment): Main-axis alignment

Control Properties

  • width (number): Width of the control
  • height (number): Height of the control
  • expand (bool): Whether to expand to fill available space
  • opacity (number): Opacity of the control
  • tooltip (str): Tooltip text
  • visible (bool): Whether the control is visible
  • disabled (bool): Whether the control is disabled

Animation Properties

  • animate_opacity (bool): Animate opacity changes
  • animate_position (bool): Animate position changes
  • animate_scale (bool): Animate scale changes
  • animate_size (bool): Animate size changes
  • on_animation_end (callable): Callback when animation ends
  • rotate (number): Rotation angle
  • scale (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)

Source distribution for flet-math 0.1.1
File Size Uploaded
flet_math-0.1.1.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flet-math 0.1.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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