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.0.tar.gz (21.3 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.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dearpygui_forms-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c6533c8a2c734b901d3acea9cc961bc6845d1fd801011c57980201de981600c7
MD5 6151238080a4bd86290d83334293f633
BLAKE2b-256 89fae4f9b19c2300a128fa5517a2ce8576657acd9967da5daf3fdf6aaf5e3d01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dearpygui_forms-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fced7e127b7c35871e33aa57b7b9adf02b28ef65b17d9e8fa50d9e7bb7ebe7b0
MD5 de72b7f6cf640d4dd302b622e59b2d2b
BLAKE2b-256 854bcca7e2034133feb0c51013a86d8c77f41868d48e50e494bc082f2567a46a

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