Forum Archive

Is it possible to create a basic GUI with scene

ylb609897

Is it possible to create a basic GUI with scene such as a basic calculator. If anyone has achieved this please can you share your code

omz

While the scene module is not really designed for creating GUIs, it is certainly possible to create a basic calculator with it. In fact, there's an example of how to do exactly that here:
http://omz-software.com/pythonista/forums/discussion/267/calculator/p1

bashedcrab

GUI Framework for Pythonista

https://gist.github.com/BashedCrab/5924965

Demo scene

https://gist.github.com/BashedCrab/5953776

If you are after a simple GUI to set a few options in your app, then you may find this helpful. If you are after a full suite of native iOS controls then Pythonista probably isn't the right tool for the job.

athros216

That's great work @bashedcrab! Well done!

omz

@bashedcrab Pretty impressive! :)

jose3f23

@bashedcrab: Thank you very much for the contribution.

bashedcrab

My pleasure. There is still a lot of refining that needs to be done. Firstly because i am only just starting to learn python, and I'm still discovering the "pythonic" way.

Secondly I'm probably going to have to abandon my initial design decision of redrawing the entire scene every frame. While it makes to code simpler and is fine for a small gui, it's killing the frame rate for a gui with over 100 components (like the demo).

Apaulsen

If you guys are struggling with this you're not doing it correctly. Use a GUI Designer, I personally use MatDeck but it's not cheap. I used to use MD Python(https://labdeck.com/python/) which is just a different version of MatDeck, it's free and has a drag and drop GUI Designer which you can make calculators with easily. However, its got limited GUI use, and the unlimited version(https://labdeck.com/python-designer/) cost around £10-20.This is the GUI Designer the software offers( https://labdeck.com/python/python-gui-designer/). If you do use it, I recommend creating the calculater and then putting an image in front of the GUI components. It makes it look a lot better and doesn't affect the GUI itself.

ccc

Does MatDeck run on iOS like Pythonista does?!?

Apaulsen

@ccc it's only compatible with windows but surely they're going to make it compatible with more software soon. Pythonista is also just Python IDE, it's not really similar to MD Python Designer.