Christopher Barker wrote:
Still, I agree that the syntax for setting up a sizer is not very intuitive.
A couple years ago there was a pretty lengthy discussion about this on the wx mailing lists. I had some ideas about how to improve things, but it really required keyword parameters, so it was a no-go in C++
However, Robin indicated that he would consider a Python-only implementation. I got as far a first version of a prototype, but I don't even remember if I ever posted it here. However, I've found it, and am posting it now.
The basic ideas are:
- the "option" parameter is totally non-intuitive, at least in name
- The flags area a mishmash pf related and unrelated functionality
- Being more verbose is good: it's better to be able to read your code an understand it than having it be quick to type.
There is also a new(-ish) way to do it in C++ that might carry over nicely to Python. There is a new wxSizerFlags class that can encapsulate all of the options and flags. Each of the wx.SizerFlags methods returns a reference to itself, so you can stack up method calls like this:
sizer.Add(item,
wx.SizerFlags().Proportion(1).Border(wx.ALL,5).Expand())
I haven't added this to wxPython yet because I need to work out a way to handle the overloading of Add() without impacting current code.
http://wxwidgets.org/manuals/2.6.2/wx_wxsizerflags.html#wxsizerflags
ยทยทยท
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!