Skip to main content

build GUIs from functions, using magic.

Project description

magicgui

License Version Python Version Build Status Docs Code style: black codecov

build GUIs from functions, using magic.

📖 Docs

Installation

magicgui uses pyqt to support both pyside2 and pyqt5 backends. However, you must have one of those installed for magicgui to work.

pip install magicgui pyside2  # or pyqt5 instead of pyside2

:information_source: If you'd like to help us extend support to a different backend, please open an issue.

Basic usage

class Medium(Enum):
    Glass = 1.520
    Oil = 1.515
    Water = 1.333
    Air = 1.0003

# decorate your function with the @magicgui decorator
@magicgui(call_button="calculate")
def snells_law(aoi=30.0, n1=Medium.Glass, n2=Medium.Water, degrees=True):
    aoi = math.radians(aoi) if degrees else aoi
    try:
        result = math.asin(n1.value * math.sin(aoi) / n2.value)
        return math.degrees(result) if degrees else result
    except ValueError:
        return "Total internal reflection!"

# your function will now have a new attribute "Gui"
# call it to create (and optionally show) the new GUI!
snell_gui = snells_law.Gui(show=True)

Please see Documentation for many more details and usage examples.

Contributing

Contributions are welcome!

Please note: magicgui attempts to adhere to strict coding rules and employs the following static analysis tools to prevent errors from being introduced into the codebase:

To prevent continuous integration failures when contributing, please consider installing pre-commit in your environment to run all of these checks prior to checking in new code.

pre-commit install

To run pyright, you will need to install with npm install -g pyright, then run pyright. See their docs for details.

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

magicgui-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

magicgui-0.1.0-py2.py3-none-any.whl (13.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file magicgui-0.1.0.tar.gz.

File metadata

  • Download URL: magicgui-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.0

File hashes

Hashes for magicgui-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a4638bb4f108f2c431fe178a35ba856a559dc746df8096d78e21b06b4a99c10e
MD5 c2ca26bc03289321bf2aef8c5d8df3a2
BLAKE2b-256 cbca9417d929adf090b4dd78237ec5e242abbab976fcdde36807485088a2cc70

See more details on using hashes here.

File details

Details for the file magicgui-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: magicgui-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.0

File hashes

Hashes for magicgui-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 79ab2825b608bb50e66d95135491569585898eb57a107f5e8a72e1aec6da2256
MD5 98c65c59a7816943cea3660d889d3770
BLAKE2b-256 79a068197f2e67b48daae9dca531d242eb321ada402445790b8123d415a00304

See more details on using hashes here.

Supported by

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