Skip to main content

Immediate mode GUI library

Project description

pyegui is a native extenstion for Python that provides bindings for Rust immediate mode GUI library egui.

Example

from pyegui import *

name = Str("Van")
age = Int(24)

def update_func(ctx):
  heading("My egui Application")
  text_edit_singleline(name, hint_text="Your name")
  slider_int(age, 0, 150, "age")

  if button_clicked("Increment"):
    age.value += 1

  heading(f"Hello '{name.value}', age {age.value}")
  image("file://image.png", max_width=350, max_height=250)

run_native("My pyegui Application", update_func)

example 1 example 2

Features

pyegui tries to be as close as possible to the original egui API, but with the focus on simplicity and usability. Callbacks were removed where possible to accomplish more smooth expirience in Python.

  • Light and Dark themes(defaults to the system’s)

  • Built-in latin and cyrillic alphabets. You can load any font you want with ctx.set_font function

  • Images(png and jpeg)

  • Date picker

  • RBG color picker

  • Text fields, radio buttons, buttons, code, progress bar etc.

  • No dependencies which destroy you project when you distribute it. Just pure giant Rust binary

Full list of implemented features is available here

Install

Prebuilt binaries are provided for Linux, Windows and macOS. On other platforms pip will build wheel for your OS. In this case you’ll need Rust compiler and maturin

Install from pypi:

pip install pyegui

Install from source:

git clone https://github.com/gachilord/pyegui
pip install <path to pyegui>

Usage

This is how you write a “hello world” app.

from pyegui import *

def update_func(ctx):
  # draw UI here
  heading("Hello, World!")

if __name__ == "__main__":
  run_native("Example app", update_func)

You can find more examples in the documentation.

Update functions

pyegui has a notion of update functions which the library calls to draw your UI.

def update_func():
  # you can place here any widget
  heading("I'm a heading")
  # some widgets are interactive
  if button_clicked("I'm a clickable button"):
    # you can update state from here or show another widget
    print("Clicked")

The top level update function has the Context object that controls global aspects of your app(e.g fonts and theme).

def update_func(ctx):
  ctx.set_light_theme()
  heading("Using light theme even if system's is dark")

Update functions may be nested. Such functions create a new UI scope that can have different styles and behaviour.

def update_func(ctx):
  # define update_func
  def nested():
    label("I'm a label inside nested update function")
    label("New label")
    disable() # this function will disable all further widgets in the scope
    if button_clicked("You can't click me"):
      print("Unreachable")
  # all the widgets inside 'nested' will be centered vertically
  horizontal_centered(nested)
  # this widget won't be disabled though it goes after 'disable()'
  if button_clicked("You can click me"):
    print("Clicked")

Containers

Containers is a syntactic sugar for code that needs update functions. Function calls are replaced by Python’s with statement.

The code that centers widgets vertically:

def update_func(ctx):

  def nested():
    label("I'm a label inside nested update function")
    label("New label")

  horizontal_centered(nested)

Can be written without callbacks:

def update_func(ctx):

  with Layout(LayoutType.HorizontalCentered):
    label("I'm a label inside nested update function")
    label("New label")

Variables

Many widgets require access to a state via a reference, which can’t be done for integers, floats and strings in Python. That’s why such helper classes as Str, Bool, Int and Float exist.

They are essentially the following:

# Example for bool type
class Bool:
  value = False

These classes can be used to draw UI or to store user input. You have to create them outside of update functions.

data = Bool(False)

def update_func():
  heading(f"Value of the data is {data.value}")
  # button will be shown only if the checkbox is checked
  if data.value and button_clicked("set to False"):
    # hiding the button
    data.value = False
  checkbox(data, "Check me")

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

pyegui-0.4.0.tar.gz (256.3 kB view details)

Uploaded Source

Built Distributions

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

pyegui-0.4.0-cp311-abi3-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.11+Windows x86-64

pyegui-0.4.0-cp311-abi3-win32.whl (5.6 MB view details)

Uploaded CPython 3.11+Windows x86

pyegui-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

pyegui-0.4.0-cp311-abi3-musllinux_1_2_i686.whl (8.2 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

pyegui-0.4.0-cp311-abi3-musllinux_1_2_armv7l.whl (8.0 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

pyegui-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl (8.1 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

pyegui-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

pyegui-0.4.0-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (7.9 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ s390x

pyegui-0.4.0-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (9.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ppc64le

pyegui-0.4.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (8.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ i686

pyegui-0.4.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (7.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

pyegui-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.9 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pyegui-0.4.0-cp311-abi3-macosx_11_0_arm64.whl (6.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyegui-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file pyegui-0.4.0.tar.gz.

File metadata

  • Download URL: pyegui-0.4.0.tar.gz
  • Upload date:
  • Size: 256.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyegui-0.4.0.tar.gz
Algorithm Hash digest
SHA256 483f2806243881b6af9a036a2a4401c94d6f5a05027419bf5a814849f220e92f
MD5 68cf18f4b89d1c2e4bff33f8d2b3d2c9
BLAKE2b-256 e3ac4956a472db93a508bc9823e8ba5471517592d0c6b8a758ef4c46628ec242

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0.tar.gz:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pyegui-0.4.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b692390c5a050f3d3673f9616e6fe1202cf56d86492a1f456976f2feffdac3e7
MD5 1a6b0199023bbcb9fe67a2929527bd0b
BLAKE2b-256 36151b2038d2a0ebcd3d3fff37420d10b0bf51b9be1ea170e893cf866020a04a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-win_amd64.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-win32.whl.

File metadata

  • Download URL: pyegui-0.4.0-cp311-abi3-win32.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: CPython 3.11+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 72cf88c1c619b4db42a8d0466f1317569ce2e5bf3f2853f846d562362999471f
MD5 7585604f6fd876a32e3319e3247397f4
BLAKE2b-256 e77e5ea388bb67f334f2591d77ffd914efbf464f0ab940335a3487eb6e270d26

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-win32.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 165d266ebb2c7ab045a395a3f3876161f72894d4423afba392478361b4ba54da
MD5 ed9b6259d0d5330f670b80dd12f5749c
BLAKE2b-256 3fab4649dcdf7186f19bb262f1a2a28b9c6e89687a642bd0bf9a8aa73e50cdfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 758b77e72a98418128a8f118440b008f905086caa6a8c5c2fa0cdd8e52208eec
MD5 386b270bc15d904070cd8212031f8558
BLAKE2b-256 73ac29478bb75de2379e804024c1615960ebe4f3e3faa1ce924630b43e104a40

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-musllinux_1_2_i686.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 3f700884ea91fb21f78801d024bec5c0657c9831ce14697cee6dffd92210ca50
MD5 318962dad920401d2c40e799dba97d12
BLAKE2b-256 e4df0a6e7b542db8cb58145c92a822c00d56b764f394ee5b0bc38a8e835293fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-musllinux_1_2_armv7l.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a1d84ed13d8bd4c86afe76c4f46be3cecf747a9273d098d3a7f5e5440c958329
MD5 811bc4ff938bfdb2c63d57406c34d84d
BLAKE2b-256 975c680c44bfdeb0d5c04659b39ef034e7cf6e832a0e31351ec7e7f076cf501a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2050da0846aa490a98289009451ec4d813a1f0861fe3e631499f6ed9a604310
MD5 18d89e0a54a82b47ad0663321b59ad34
BLAKE2b-256 31c06df83a0ddca5f2167bf68f3a8c360e1ca862df0946bf787678d0cd45a88f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 8f6ef00497c3f8333bafeab8346311bcbf4f063a40489365071125bee0cc4cff
MD5 d06be03c9463d9dc47b2e3b9886b7b3c
BLAKE2b-256 d5c0ece050599c93127e34741fb918928239e4a0e8d5fffe799e47870af2cd17

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 310b4dcf8ad99329c462f7cf93ffd314785eff4336c30831d4517ff1c99fab62
MD5 2eff37c9aff0e03188e7f0987fb8404a
BLAKE2b-256 c9a12d340d1d933e4d975a8bf0c01ab12d96e7adb938851ebaecfd835cda436c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 dcec5744d705bdb053d7a922d29cc4674fbe80faa478089ec92651c7a9dbd985
MD5 d8c8835d54469d2c40ef202961684aff
BLAKE2b-256 d650e1ab2ea31dd67b23f6132dee6d08223ffcd8afb17cad75f6001452bb2b8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 0dc0b239b39f51dba55475045fd67ecd92954aa0d59f7e480639cf99aaa43c84
MD5 933288c40589a71c55249637f95711d4
BLAKE2b-256 3b15c8c87afefe2d9a7da0c197c565861b4dc09eb98f5db372587775dd048dca

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4e22e481a7f6b378be73b40aa5ea12b527d04f5f5c26acffc01aa0f456b9f5ef
MD5 a8eebc440ebb1cf07db5cb1575a83c5e
BLAKE2b-256 c392dab11f639963f2f677d4001a5c7c2fa3a6a8567fdf5ec6b765d0f4c30453

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe205df836a4cdeaed02f5478df81d2feabb43ac15b2ddc8b60a51230d11a7a0
MD5 ad4fec7dffc67e149cc3d3a4c91506e3
BLAKE2b-256 ec46f9d6341954ae4102c815c71cf8f02bc3ba34de35de3704e75720f7ea9d5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyegui-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyegui-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ba5a9d8d795c07d1084279ea2257be138d1f1143f18b751e5d1175d778b70a60
MD5 28c0f4b047ef465ed28467cebfe3e035
BLAKE2b-256 3342d3a499f50beaabc81d0f81003744ef3b46d1b2a3888bad4d8ae331826ac5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: CI.yml on GachiLord/pyegui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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