Join GitHub today
Support ContextManagers for GUI & container start/stop... #234
There's a lot of start/stop in appJar.
It would be nice to add in support for
Already in use for event raising & logging passing, notes here: http://effbot.org/zone/python-with-statement.htm
I'd like to be able to achieve:
with gui("my first gui") as app: with app.addLabelFrame("lf"): app.addLabel("l1", "some text") app.addLabel("l2", "some text") with app.addScrollPane("sp1"): app.addLabel("l3", "some text") app.addLabel("l4", "some text")
I'm sure it can be done easily on the main gui class, but imagine it'll take a bit more work for all the containers...
It shouldn't break backwards compatability!
So, there are lots of interesting things available here.
This is a good read: http://preshing.com/20110920/the-python-with-statement-by-example/
We currently do the following:
And the user calls:
We can replace the start/stop with a generator:
Then the user would call:
I really like the look of this - but need to keep it backwards compatible.
It won't be necessary to have the container check, as the indentation manages the stops...