Skip to main content

An easy-to-use package for creating functional GUIs very quickly

Project description

SwiftGUI

A python-package to quickly create user-interfaces (GUIs).

I really liked PySimpleGUI (before they went "premium"), but their codebase is an utter mess.

SwiftGUI adapts some concepts of PySimpleGUI, but is even simpler (in my opinion) and allows writing less offputting code.

Compatible with Python 3.10 and above

, but intended for Python 3.13 and above.

Getting started

Start your journey here

Now with themes!

Does your GUI look shitty?

Just call sg.Themes.FourColors.Emerald() before creating the layout.

See which themes are available by calling sg.Examples.preview_all_themes().

Alpha-phase!

The package is useable and already has 23 (Version 0.6.0) finished elements.
I am already using it for smaller projects and personally, like it a lot.

However, until version 1.0.0, the package is not guaranteed to be down-compatible. Names and functions/methods might change, which could destroy your code.

For version 1.0.0, I'd like to sort and standardize names, so they are easier to remember.

Of course, older versions will stay available on pip, so if you worry about this, just don't update the package.

Legal disclaimer

I did not copy any code from the (once) popular Python-package PySimpleGUI.

Even though some of the concepts are simmilar, everything was written bei me or a contributor. Element-names like Table and Input are common and not owned by PySimpleGUI. Even if they were, they got published a long time ago under a different license.

installation

Install using pip:

pip install SwiftGUI

Why SwiftGUI?

I have a lot of experience with PySimpleGUI, used it for years. It is very useful, but has a lot of super annoying aspects.

This is what I hate about it:

  • PySimpleGUI is pretty much impossible to expand, because of the codebase.
  • PySimpleGUI is only efficient for smaller layouts. There are just some things, you do in most bigger layouts, which are very annoying and time-consuming.
  • PySimpleGUI doesn't really let you copy parts of your layout automatically. If you want to copy it, you must copy code (or create a custom function). When you want to change certain aspects of all copied elements, you need to change it in every copy. Very inefficient.
  • The only ways to convey events in PySimpleGUI is through breaking out of window.read(), or writing events onto the tkinter-widget directly. Due to that, in bigger layouts, the code becomes cluttered quickly and has a lot of redundancy.

SwiftGUI is the answer to these negative aspects. It allows you to create bigger GUIs, quickly and elegantly.

Features and Differences to PySimpleGUI

Disclaimer: I did not copy any code of PySimpleGUI. This library is completely independent of PySimpleGUI and aims at making it obsolete.

Some of these features haven't been implemented yet, but the package is created in a way that all of these will be possible without any major hussle.

Layout

The way you create layouts is pretty much the same as in PySimpleGUI.

(Not yet) However, in swiftGUI it is possible to copy parts of the layout.

Events

In PySimpleGUI, every event has to have a key and always breaks out of window.read(), slowing down the code.

In SwiftGUI, you have the option to pass "key-functions" (additionally to the normal key). When an event occurs, these functions will be evoked too.

E.g.: Let's say you want to add a button that clears out an input-element. In PySimpleGUI, you would need to give that button its own key, add an if-statement to the main loop, just to make the call window["InputKey"]("")".

In swiftGUI, the only thing you need to do is pass a lambda-function as a key-function to the button: sg.Button(...,key_function=lambda w:w["InputKey"].set_value("")).
Done.
No breaking out of window.loop(), no if-statement, no key "used", not even an additional line of code.

Additionally, there are a couple of pre-made "key-functions" you can configure and use. The clearing out of an input is one of them, so no need to write the lambda.

Elements/Widgets

Additional to the standard-widgets of Tkinter that PySimpleGUI has, SwiftGUI offers a selection of "combined elements" and elements with extended functionality.

These combined elements contain multiple tk-widgets that mostly get interpreted as a single value.

E.g. the Form-Element consists of multiple rows of text-input-combinations. The values can either be packed into a dictionary to use less keys, or every Input gets its own key.

This is something most layouts need to have, but with PySimpleGUI, you need to create every Element one by one, or create a wrapper (which is very janky due to PySimpleGUIs codebase).

Expandability

SwiftGUI aims at being as easy to expand as possible.

There will be tutorials on how to use the codebase.

Feel free to take a look at Widgets.py and WidgetsAdvanced.py.

Project details


Release history Release notifications | RSS feed

This version

0.7.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swiftgui-0.7.3.tar.gz (97.5 kB view details)

Uploaded Source

Built Distribution

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

swiftgui-0.7.3-py3-none-any.whl (126.2 kB view details)

Uploaded Python 3

File details

Details for the file swiftgui-0.7.3.tar.gz.

File metadata

  • Download URL: swiftgui-0.7.3.tar.gz
  • Upload date:
  • Size: 97.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.0 Windows/10

File hashes

Hashes for swiftgui-0.7.3.tar.gz
Algorithm Hash digest
SHA256 7b9a8014e4e71acc4826e6ce6662e60d1ce7c978ceda6956cef21a1f4f53d1f4
MD5 b3eeb467c27f33388311148ce33d5f36
BLAKE2b-256 64a84f69a53d4ebac853a0e3cf1aa7b9d0ac2e5feb2272673f7006e58cb127f3

See more details on using hashes here.

File details

Details for the file swiftgui-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: swiftgui-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 126.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.0 Windows/10

File hashes

Hashes for swiftgui-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d3f2d628fcb749a07769cce12956f65c80370ee6c38891a7d0e524fa7c66d3a7
MD5 7c4960e4188ae616e8df81fa3eb97b52
BLAKE2b-256 43774b1b6727505c18c3e421b969d2d4ad16711169a3510096dbd4e7fc5464ab

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