Skip to main content

A GUI builder for pygame (using pygame_gui).

Project description

PgStudio 0.4.0

NOTICE: PgStudio is currently in early beta and far from complete. Please do not expect a bug-free experience or a “perfect” product at this stage. Updates will be rolled out periodically as the project continues to evolve and expand. We welcome feature suggestions and bug reports—feel free to share them with us on our Discord server at Taireru LLC ™ // PgStudio // #bugs-and-stuff.

a GUI editor for pygame using pygame_gui.

features (new in 0.4.0)

  • Error dialogs: any time something goes wrong (save, export, rename, drawing, etc.), you get a UIMessageWindow explaining what happened.
  • Theming: includes themes/pgstudio_theme.json. if present, PgStudio will load that and skin all UI elements (buttons, panels, labels, etc.).
  • Undo/Redo: any add/delete/rename/property change is recorded. toolbar has “Undo” and “Redo” buttons.
  • Custom event hookups: for Buttons, you can now pick on_click—choose a Script from your /scripts/ folder. on export (main.py), those scripts get imported and called when the button is pressed.

License Agreement

When you launch PgStudio, you will be presented with a Software User Agreement dialog. You must accept this license agreement before using the software. Key points include:

  • By agreeing, you confirm your legal acceptance of the terms governing PgStudio’s use.
  • You may not copy, modify, redistribute, or create derivative works from PgStudio’s source code.
  • You may view the source code for informational purposes only.
  • Generated content you create with PgStudio belongs to you, but the original software remains proprietary.
  • Declining the agreement or closing the prompt will automatically attempt to uninstall PgStudio.
  • The agreement disclaims liability and prohibits unauthorized monetization.
  • Legal jurisdiction is the State of Arkansas, USA.

If you do not agree, you cannot use PgStudio.

install

pip install pgstudio

quickstart

import pgstudio

pgstudio.configure(core="path/to/my_project_folder")
pgstudio.launch()
  • this creates:

    • my_project_folder/objects.json
    • my_project_folder/scripts/
    • my_project_folder/images/
    • (optional) my_project_folder/themes/pgstudio_theme.json if you want theming

UI overview

  1. Toolbar (top):

    • Undo: undo last change
    • Redo: redo last undone change
    • Save: force‐save objects.json now
    • Export: generate main.py with event hookups
    • New Prjct: wipes all objects, scripts, images (with confirmation)
  2. Explorer (left):

    • shows a collapsible tree of all objects.
    • right‐click on blank → add root objects
    • right‐click on object → add child / rename / delete
    • arrow icon (▶/▼) toggles expand/collapse
  3. Canvas (center):

    • drag objects around (nested transforms respected)
    • resize using bottom‐right corner
    • draw order by z_order (higher drawn on top)
    • click to select; selected object has yellow outline
  4. Properties (right):

    • shows/edit properties for selected object:

      • abs_x, abs_y (auto-convert to relative under the hood)

      • w, h, visible, z_order, name

      • type-specific:

        • Rectangle: color picker
        • Button: text, font_size, color, on_click (choose from scripts)
        • Label: text, font_size, color
        • Image: file picker (choose image from filesystem)
        • TextInput: placeholder, text_color, bg_color
        • Script: “Edit Script” button (opens in default editor)
    • always has a Delete Object button

  5. Error Handling:

    • if anything breaks (e.g. invalid number in property, file‐I/O fails, draw error), a UIMessageWindow pops up explaining it.
  6. Theming:

    • if you place a themes/pgstudio_theme.json in the package (or modify it), PgStudio will load it and skin all UI.
    • sample theme changes button colors, panel BG, label text color, text entry style.

undo/redo details

  • every time you call any method that mutates (add, delete, rename, update), PgStudio first snapshots the entire nodes dict as JSON.
  • Undo pops the last snapshot, pushes the current snapshot onto the redo stack, and restores the old one.
  • Redo does the reverse.
  • Undo/Redo works for: add_object, delete_object, rename_object, update_properties, move_node.

custom event hookups

  • only Buttons have event hookups currently. in the Properties panel for a Button, you see an on_click dropdown that lists “None” + every Script in /scripts/.

  • if you choose a script (say MyScript), PgStudio stores node.events["on_click"] = "MyScript".

  • on Export, main.py is generated so that:

      import scripts.MyScript as script_<button_id>
      ...
      if e.type == pygame_gui.UI_BUTTON_PRESSED and e.ui_element == elements['<button_id>']:
          script_<button_id>.run(elements['<button_id>'], event=e)
    
  • thus, in your scripts/MyScript.py, just define a run(obj, event=None) function and do whatever you want.

theming

  • the included themes/pgstudio_theme.json is a minimal example. you can customize fonts, colors, etc.
  • if you remove or rename it, PgStudio falls back to the default pygame_gui theme.

error dialogs

  • uses UIMessageWindow for anything from drawing errors, file I/O, invalid user input, etc.
  • you’ll see a pop-up with a title and message.

how to develop locally

  1. open your local terminal

  2. run pip install pgstudio

  3. open your local ide

  4. make a new script and run:

    import pgstudio
    pgstudio.configure("my_test_project")
    pgstudio.launch()
    

enjoy building UIs without writing all the boilerplate—just drag, drop, click, export! 🚀🎨

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

pgstudio-0.4.0.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

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

pgstudio-0.4.0-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pgstudio-0.4.0.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pgstudio-0.4.0.tar.gz
Algorithm Hash digest
SHA256 dbcce5f1374f6455e2b4461ff4a575f031ea7fd3c98689a392290933810c3354
MD5 4712659f7081c8001658f8c24c608634
BLAKE2b-256 cb9da3062c4d19ca99bc0d4d23f3fccbe82f2b2470cedac4edf0e6f30557862d

See more details on using hashes here.

File details

Details for the file pgstudio-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pgstudio-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pgstudio-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b31161baa2eb0a5501af80ee9d99895239c64d6b1c7390269283c6be482ebe88
MD5 508363f95bf5bd78660cee2cec741923
BLAKE2b-256 afac777d1266175c6938b25cd248f7165d0743632a493845ffa1a5403f394c65

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