-------------
It's a GUI framework prioritizing portability, simplicity, and a Pythonic feel.
If you want to build a simple GUI for a simple task, I recommend this package whole-heartedly. I don't think this is just pride in my own work -- I'm pretty sure that this package *actually is* very easy to learn, and very good for simple things.
If you want to build a video game, or a nice, fluid 3D visualization, this is easily the worst GUI framework I have ever seen.
- [Why is it good?](#why-is-it-good)
- [Why is it bad?](#why-is-it-bad)
- [What are the alternatives?](#what-are-the-alternatives)
- [How do I install it?](#how-do-i-install-it)
- [How do I learn to use it?](#how-do-i-learn-to-use-it)
Why is it good?
---------------
This package prioritizes ease of use, portability, and good documentation above all else. The following statements will remain true as long as I have breath left in my body:
- **It feels like Python.** It uses HTML/CSS/JS under the hood, but that fact is carefully hidden under nice object-oriented abstractions. Contrast with [Tkinter][tkinter], which feels like Tk, because it is.
- **It has a shallow learning curve.** "Hello World" is `GUI(Text("Hello world!")).run()`. Minesweeper, including the game logic, is [less than 100 lines of code][minesweeper-code] and [looks like this][minesweeper-screenshot].
- **It's super-portable.** `pip install browsergui && python -m browsergui.examples` has worked, with no snags, on every system I've tried (OS X, Debian, and Ubuntu, with both Python 2.7 and a few Python 3.Xs). Seriously, you could run that right now and it would work, without a single abstruse error messages about your Qt/wx/PyObjC installation. At the risk of tooting my own horn, I've never seen another GUI library so easy to install.
- **It's well-documented.** There's a [wiki][wiki] to teach you how to use it. There are [examples](#how-do-I-learn-to-use-it). There's a [reference manual][docs]. There's a [runnable demo for every predefined kind of element][tour-screenshot]. I've spent more time documenting than I've spent writing actual code.
Why is it bad?
--------------
- **It's slow.** It does not even try to be high-performance. There's an HTTP request every time the user interacts with the GUI, and again every time the view is updated. Performance is off the table. (It's not *frustratingly* slow -- you can drag a slider and see the value update with no perceptible delay -- but it's not good for fancy stuff.)
- **It's not super-easy to make super-pretty things.** I just haven't prioritized styling: any styling you want to do, you have to do through CSS. I'm not sure `element.css['color'] = 'red'` is so much worse than `widget.config(foreground="#f00")`, but it *does* feel like a thin wrapper over CSS (because it is), which is gross.
How do I install it?
--------------------
If you use pip, `pip install browsergui`.
If you use easy_install, `easy_install browsergui`.
If you don't like package managers, just unzip [this][download-zip] and put the `browsergui` folder anywhere on your Python path.
Once it's installed, I recommend running `python -m browsergui.examples` to see a catalog of all the kinds of building blocks available to you, or checking out [the wiki][wiki] for tutorial-type stuff.
How do I learn to use it?
-------------------------
[The wiki][wiki] has several tutorial-type pages. Or you could just extrapolate from these examples:
- Hello world:
from browsergui import GUI, Text
GUI(Text("Hello world!")).run()
- A number that increments every time you press a button:
from browsergui import GUI, Text, Button
button = Button('0')
@button.def_callback
def increment():
button.text = str(int(button.text)+1)
GUI(button).run()
- A clock:
import time
import threading
from browsergui import Text, GUI
now = Text("")
def update_now_forever():
while True:
now.text = time.strftime("%Y-%m-%d %H:%M:%S")
time.sleep(1)
t = threading.Thread(target=update_now_forever)
t.daemon = True
t.start()
GUI(Text("The time is: "), now).run()
(You can close/reopen the browser window at any time; Ctrl-C will stop the server.)
Each kind of element (`Text`, `Button`, `ColorField`, `Grid`...) also has a simple example showing you how to use it: `python -m browsergui.examples` will display all those examples to you.
What are the alternatives?
--------------------------
I am aware of some GUI toolkits for Python that fill a similar niche. You should consider using these instead:
- [tkinter][tkinter] (standard library)
Advantages: it's in the standard library. It has always worked out of the box for me. If you want maximal portability, this is probably your best bet.
Disadvantages: it feels like a wrapper around Tk, because it is. This gives good performance and detailed control, but writing it feels unintuitive (to me).
- [pyJS][pyjs], another Python package for making GUIs targeting browsers. It works by compiling your Python code into a slug of JavaScript which runs in the browser.
Advantages: pyJS applications are much faster and much easier to deploy (since it doesn't require the user to run Python).
Disadvantages: I had trouble installing it. And like `tkinter`, it's a wrapper, with the same dis/advantages.
There are, of course, many other GUI toolkits. [Here][official-alternatives] is a list of those popular enough to earn the notice of Official Python People. [Here][unofficial-alternatives] is a paralytically long listing of less-notable ones.
[minesweeper-code]: https://github.com/speezepearson/browsergui/blob/master/browsergui/examples/minesweeper.py
[minesweeper-screenshot]: http://i.imgur.com/8Ax04sZ.png
[tour-screenshot]: http://i.imgur.com/AvVVVFd.png
[download-zip]: https://github.com/speezepearson/browsergui/archive/master.zip
[wiki]: https://github.com/speezepearson/browsergui/wiki
[docs]: http://pythonhosted.org/browsergui
[download-zip]: https://github.com/speezepearson/browsergui/archive/master.zip
[tkinter]: https://docs.python.org/3/library/tkinter.html#module-tkinter
[pyjs]: http://pyjs.org
[official-alternatives]: http://docs.python.org/2/library/othergui.html
[unofficial-alternatives]: http://wiki.python.org/moin/GuiProgramming
Metadata
Release files for browsergui 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| browsergui-0.4.tar.gz | 55.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| browsergui-0.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 114.8 kB
Release files / browsergui-0.4.tar.gz
| Download URL | browsergui-0.4.tar.gz |
|---|---|
| Size | 55.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f106c4e03b9b2ff4af8cd78e8b26c4f7e3100fbe80f513e9dc4eb28510b96ef
|
|
BLAKE2b-256 checksum How to use checksums |
f951635164aa5d02ec6ff58db26e0a0991ca58d98f5d19a1ee4d0a21b4a6d83b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / browsergui-0.4-py2.py3-none-any.whl
| Download URL | browsergui-0.4-py2.py3-none-any.whl |
|---|---|
| Size | 59.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4b739133f0d46b0d9a341dcc8f46659700755d97ec35fe4ce5061b4371be21f5
|
|
BLAKE2b-256 checksum How to use checksums |
e2dff772846622c5f0a23119569064065041c3b2b3b2be47a4a1b7365513dfb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for browsergui 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.