|
From: <bra...@om...> - 2005-09-28 18:25:15
|
> Alex Tweedly wrote:
> I've written a simple sizer that (I think) does what I was thinking of.
> It's pretty simple-minded, but if you have a simple, straightforward
> layout, this will "work" most of the time. It's not always great -
> layouts can often look stretched, but it achieves the main purpose of
> making fields larger as the window size is increased.
Oh, wow. Wow, wow, wow. This works great with my app. Mr. Tweedly, I bow
and
scrape at your majestic feet.
I just sat down to resume work on my project after weeks away from it, and
recalled that trying out simpleSizer was on my to-do list. Little did I
realize
how amazingly simple it would be to implement, and how effectively it
would
improve my tabbed interface app.
One of the reasons this is so gratifying is that I kept seeing my boss and
a couple of other end users unconsciously trying to resize the main
window even
when it did not have resizeable enabled and they knew full well the
feature was
not implemented.
To implement simpleSizer in my apps main window (and it's child tabs), all
I
needed to do was make the main window resizeable using Resource Editor,
and add
import simpleSizer
simpleSizer.autoSizer(self)
to two different on_initialize methods -- one for the main window, and one
for the parent class of all the tabs. This caused ALL the tabs and child
tabs
to resize their contents beautifully as the window was resized.
I've only tried this on a couple of the more complex child windows, but so
far so good. The only trouble I ran into was a ZeroDivisionError.
Traceback (most recent call last):
File "/OMS/dev/main/OMS/Mycroft/source/client/simpleSizer.py", line 44,
in RecalcSizes
scaleX = 100 * curWidth / minWidth
ZeroDivisionError: integer division or modulo by zero
It turned out that this error went away after I made sure the child window
that generated was resizeable.
You might notice I stuck simpleSizer.py in one of my own packages rather
than
in PythonCard. It works fine that way. When simpleSizer makes it into
PythonCard CVS, I will change my import statements and get rid of the one
from my client package.
All my testing has so far been on Mac OS 10.4.2, wxPython 2.6, and
PythonCard .82, and on Windows XP with wxPython 2.6 and PythonCard .82.
I vote for simpleSizer to go into PythonCard CVS ASAP. It's not going to
break
anything else because nothing else is dependent on it yet. It's a great,
super-easy way to add sizers to PythonCard. It obviously hasn't been
tested
in every scenario, and it's not perfect, but it's far better than no
sizers at all.
It's also very in keeping with the PythonCard spirit of shallow learning
curve.
And putting it out there at will net us a lot more testers. Why wait for
2.0?
Brad Allen
IT Desktop Support
Omnicom Management Services
Dallas, TX
http://www.omsdal.com
|