News for hackers. Stuff that matters.
Re:Python Universal GUI (tkinter, wxwidgets, winforms with s... by etal on Saturday August 23, 2008 @10:58AM (#284643)
The thing that I've idly wished would work in PyGTK and wxWidgets (the ones I've used and liked) has these features:

- takes full advantage of data-type literals like dictionaries and lists

- allows method chaining -- I think this implies mywgt.add(NewWidget(), callback, data) must return a new modified object, rather than modifying mywgt in-place and returning None.

So I can build an app the clean way (generated XML or Django-style models), and then if I need to whip up a simple dialog in straight Python, I can do it like this:

    import gui
    myframe = gui.Frame(
                    title="Password",
                    width=300,
                    modal=True,
                    ).add(gui.Col([
                        gui.Label("""Enter the password to enable
                                  this feature:"""),
                        gui.Password(),
                        gui.HRule(),
                        gui.Row([
                           gui.Button("OK", self.accept),
                           gui.Button("No!", self.cancel)])
                        ]))
    myframe[3][1] += gui.Image("images/hellno.png")
Not sure if it's possible to use dictionaries as part of the toolkit since ordering is lost, but you see the idea: let container widgets like HBox and VBox accept literals instead of requiring repeated foo.insert() calls; have different methods for in-place modification and returned values; implement container widget's magic attributes like __getitem__ to allow semi-obscure shorthand (since the inline Python form is mostly for simple throwaway/prototype code). There are probably a lot more shortcuts I'm missing; I haven't had my coffee yet and I'm no guru to begin with.
Re:Python Universal GUI (tkinter, wxwidgets, winforms with s... by seunosewa on Tuesday December 09, 2008 @07:39AM (#391232)
I see what you mean, and I agree. In other words, we need a "wxQuery" library.