Skip to main content

Камера для Flet через WebView

Project description

flet_camera

📸 Кастомный компонент камеры для Flet с WebView + WebSocket.

Установка

pip install flet-camera-webview

Использование

import flet as ft
from flet_camera import CameraWebView


def main(page):
    cam = CameraWebView(page)
    
    def save(e):
        image = cam.get_image_bytes()
        if image:
            with open("photo.jpg", "wb") as f:
                f.write(image)

    page.add(
        ft.Column(
            [
                ft.Stack(
                    [
                        ft.Container(
                            content=cam,
                            border_radius=150,  # 🎯 закругление — круг!
                            clip_behavior=ft.ClipBehavior.HARD_EDGE,
                            alignment=ft.alignment.center,
                            bgcolor=ft.colors.BLACK
                        )
                    ],
                    width=300,
                    height=300,
                    expand=False
                ),
                ft.ElevatedButton(
                    "📸 Снимок",
                    on_click=save,
                    width=160,
                    height=48,
                    style=ft.ButtonStyle(
                        shape=ft.RoundedRectangleBorder(radius=25),
                        padding=20
                    )
                )
            ],
            alignment=ft.MainAxisAlignment.CENTER,
            horizontal_alignment=ft.CrossAxisAlignment.CENTER
        )
    )



ft.app(target=main, view=ft.WEB_BROWSER)

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_camera_webview-0.1.4.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

flet_camera_webview-0.1.4-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file flet_camera_webview-0.1.4.tar.gz.

File metadata

  • Download URL: flet_camera_webview-0.1.4.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.12

File hashes

Hashes for flet_camera_webview-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d9137e170ef9d0478b8722b467275866a75b6a2f8e99c2c7b5b334cf816a457d
MD5 571f9fb11dd37b1ec7b98fbde706a34b
BLAKE2b-256 19231fa2c910fd1419c9c1ba53ef549209a671be42bf52cc243c92b8cb477b47

See more details on using hashes here.

File details

Details for the file flet_camera_webview-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for flet_camera_webview-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 54f5b43360de501ae17d31e567de88327b873622e76354d9d5e074ddcf301397
MD5 bd458fccf4e548025462720f61ae77b4
BLAKE2b-256 b0e7cf897708fede4fe60460f10fc51b6e1d8ffbc38d96b711f850b282d6edc6

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