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.5.0.tar.gz (256.5 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.5.0-cp311-abi3-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+Windows x86

pyegui-0.5.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.5.0-cp311-abi3-musllinux_1_2_i686.whl (8.2 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

pyegui-0.5.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.5.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.5.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.5.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.5.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.5.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.5.0-cp311-abi3-macosx_11_0_arm64.whl (6.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyegui-0.5.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.5.0.tar.gz.

File metadata

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

File hashes

Hashes for pyegui-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d240b57ddc7b7b52fa8d5587cec5a75d6dd4ed2702323f2c619bd69e131c6775
MD5 ac177e6a63e04864ba47de8b18157c7e
BLAKE2b-256 09ecf4f6ec6fff944245c89f05016e471bac2bf152d8bd462543faca8fa9c9ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pyegui-0.5.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.5.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bf74e8f4ea461200df0a8335afcc75234e1f77380c4a73ad938758d4b8d5121a
MD5 8f48e92e50e7c53f7590f82253f39571
BLAKE2b-256 02cfae8dcd79b644d6fe52a100708c14fcac7ea394d2f240d384d2e8ae6a4a83

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-win32.whl.

File metadata

  • Download URL: pyegui-0.5.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.5.0-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 dbbbd114d43ed360df540696f0ce5e4456a88f0b6208cf9f769a3cbd7269092e
MD5 ed3d6844a5701c4cba155b8197d75de7
BLAKE2b-256 1bcb7e20cad3249f283c5c540881dd3b9cef0ae6b9dace5be9a67ad44071ffc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bbf77fc3a6eeb1223af578044f55258c4c3f913dc90d4dfab81ab8ac7a780073
MD5 0e04c0cd2f71d75f5b6ec748d79aa2e7
BLAKE2b-256 5988bea5090a8cae2add87cd57740c00aaf3e26e085a143834cdc2bb08053f64

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 e68b8b14e1bf6abccdff2ddbb7c38925714462f970180f5079c331ddac1dfe65
MD5 28c6a19355892bafd547dfee03785de2
BLAKE2b-256 a17636264c1bf9e0efda82905668085ec59d5198f92d3ebc22bd8357cb973a08

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 97a86488a87e4c2ae45d18ec100c339ec57fcc8a90aca19fdbb6403ba052bb7f
MD5 119b89af25f5f61b94b445a78efa66d4
BLAKE2b-256 206da7ff59a0bcdbd95d4699d8a4c23b14e98670fdf00d7798fa9e24c0312ae5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 58d03226a94067f385494503578eca190dbd133e422daf9a2017fe48d4fff97e
MD5 42e5d6dc538fab5fce14e1c1b517e083
BLAKE2b-256 a75a9b23cb031b182acca0e77b0ef8b8e02413a8fc34b198bfce47807c77d844

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b9ac49158ac0cda5a75ea2be0cad403b588ceb8e03de91f974ec672216d96da
MD5 129faebecee6239a58d302e29b3537a2
BLAKE2b-256 793a7cebbb7e32d64d76bb4bdcbf2e939ffaa24a88f6407661041195d3c89737

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 2fb1b8b7f1146b31bb2ca487fde9ddace0618ab35c60c78b06f9ca32f802820a
MD5 ffa12b2cb09a210f3758cd0e77090504
BLAKE2b-256 35bce7cdbe674bffb0c767a99afadf8e292df86b3580f36a23355dd0ca195820

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 4c4179bcd3426c397fd471f0b1910515adaf408775ec736d012a65a6ca81e2d4
MD5 5167c031a146f36c655252479640163a
BLAKE2b-256 f86be5e2d09a67adad0de07500709da7775144e4fb836882a91beb6ce6c9697a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 2ec9462b17af70b57491612020d594c3a3d5614a4d4682ff67a15939d409f292
MD5 32dcd9ae8d6babb9e062f16f3a199bd8
BLAKE2b-256 2b4bcadf6d45cc6007a3fe0203b37ef068c807a2878774fce2bf9859b76e13e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 6f32a52de2046800b927b1e616f878954260accc21dc15419ee9d226bd3a442a
MD5 03ee4b0255c03c170c12a2da8a6674a2
BLAKE2b-256 a887c2b2a5fa390df0339445c7d8ec4d24df5d7d73ff630bd37e763a8d7dbd02

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f8868cf6e3ce6ebc15085b920fee8109f1e0e0909e2a74681c3bfdb0569ab2be
MD5 e3ddf76b4da53cd3790bebfd07688ef9
BLAKE2b-256 a387aaa027df4723d810a68225d37ca3333a5d1be5ac36a71baef705de59f2a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae0584123cefecd5642086db1327457b42ea29211ca14fb246a46924539272eb
MD5 d1de5bd2ca295b2648f7af472ce1c370
BLAKE2b-256 ce10cbbf896d01b3278b9786103ca9e18744547ea6292594d7eb1cda20c6a5db

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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.5.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyegui-0.5.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b877457350112cd2264f4ad14771c5564a4a1badbe71e38ebdb359df30775dcf
MD5 7850c7dc8a869fd03bc4cd8e66bc00cb
BLAKE2b-256 8fcec33ca9b178a75b3108ec7783d2eb9452c6dd2688beb36daa31a04f8efaa3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyegui-0.5.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