Skip to main content

FletMath control for Flet

Project description

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

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

flet_math-0.1.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flet_math-0.1.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file flet_math-0.1.1.tar.gz.

File metadata

  • Download URL: flet_math-0.1.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for flet_math-0.1.1.tar.gz
Algorithm Hash digest
SHA256 25def6a4cef8e917615fcf466ef16263cd30389a26199f4e98f75a69f3ec868c
MD5 0d2ca5dba3033358e13a0e7858cb54ce
BLAKE2b-256 e9065b80fc36af58aacbae39da6f502211ef47754ded48be152eb7a1d6503485

See more details on using hashes here.

File details

Details for the file flet_math-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: flet_math-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for flet_math-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c410f1a7dae77a13057cd1954e4a467a8e889232fa201261d8ff1b88685e9d93
MD5 16b16cbdda5c67254f0fd14af4ce58e9
BLAKE2b-256 b67e1b216071c1d8c6e89486ed8692af68bdc2b5cf0f17780c30657b7df399ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page