Skip to main content

Dearpygui extention for autogeneration forms powered by pydantic.

Project description

DearPyGui Forms

Generate GUI forms for your Pydantic models.

Features

  • Fill form fields with Pydantic model data
  • Fill from fields with default values
  • Validation on form submission
  • Callbacks for form submission

Currently supported Pydantic fields:

  • nested entities
  • arrays
  • str
  • int
  • float
  • bool
  • datetime
  • date
  • time
  • anyOf sequences

Example:

from pprint import pprint
import dearpygui.dearpygui as dpg
from pydantic import BaseModel, Field
from dearpygui_forms import DPGForm

class User(BaseModel):
    name: str = Field(default="John Doe", min_length=3)
    age: int = Field(ge=18)


class Storage(BaseModel):
    users: list[User] = []

class UserForm(DPGForm, model=User):
    pass


dpg.create_context()
dpg.create_viewport()

store = Storage()

with dpg.window(label="User Form"):
    user_form = UserForm(callback=lambda x: store.users.append(x))
    user_form.add()
    dpg.add_button(label="Print Users", callback=lambda: pprint(store.model_dump()))
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

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

dearpygui_forms-0.3.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

dearpygui_forms-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file dearpygui_forms-0.3.0.tar.gz.

File metadata

  • Download URL: dearpygui_forms-0.3.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for dearpygui_forms-0.3.0.tar.gz
Algorithm Hash digest
SHA256 075bd5ec8da721be361616749ad7c7857163cbb23636b47bc05961dee04d1fa1
MD5 3dd56798f8b985503b7a070e86dab246
BLAKE2b-256 ecc079acfbe7029f425d0b59b6c395d44138a323abe05d1c5e14e8044f1636b0

See more details on using hashes here.

File details

Details for the file dearpygui_forms-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dearpygui_forms-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b15736f65f9930a3230c24da69d19b96acba5b2f2ca77d9bf27beb517d3b47b3
MD5 ae1457eb7ab8e0ef6be87f8a27d4aefc
BLAKE2b-256 474f2744dc81983e5898b4d67d521221844a0913789ee0f72c0d82910509fd7b

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