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:

  • str
  • int
  • float
  • bool
  • datetime
  • date
  • time

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.2.1.tar.gz (21.7 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.2.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dearpygui_forms-0.2.1.tar.gz
Algorithm Hash digest
SHA256 52709f27307a46cf9d2680ae3e8f4ac2d3351bb60e7aa89360a283a2832f68a3
MD5 18f826b6a86bebf785775f271273179c
BLAKE2b-256 fa9f22819add093ae79e6decd2f54b8589f865ff7c9d5e03b182ff5030dc66b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dearpygui_forms-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04338c10888f33f9a3d53b07723449f6d3271b0b8f2ed0104af596a671658440
MD5 507a8fc92aa51e8d90ea41e26769adbc
BLAKE2b-256 0132f9e2d3639a855f318156224c47441baf9daaeb155ebf7f48364b6486c3ba

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