From: Alex T. <al...@tw...> - 2005-09-03 22:56:16
|
Alex Tweedly wrote: > > 1. sizer design / geometry management > > Yes, you can add sizer code - but it's just so un-PythonCard-like. It > feels as bad as writing in wxPython :-) > > In fact, I think I want two kinds of geometry management: > a. something very simple. > In the resource editor, select an option that says "resizeable > components" and it just does it. > Very simple assumptions (all textareas expand in both directions, all > textfields in X only, everything else is fixed size and just spreads > out ....) - BUT it does imply GetBestSize() on each component, so > should handle cross-platform issues for that subset of cases where it > works at all. > > Sometimes it will work, many times it won't - but if you're doing some > simple utility with a minimal GUI (2 or 3 preferences, a couple of > text input fields, a button or two plus one or two scrollable areas > for output), this could get it close enough. 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. It should (untested) manage simple cross-platform issues (buttons should be larger on Mac, etc.) - though if that means they overlap, well, they just overlap. You can lay out the design with a bit of slop in Windows and it should be OK. To try it out (please do) 1. the file (simpleSizer.py) is attached - put it in PythonCard directory 2. add from PythonCard import simpleSizer 3. in the background's on_initialize(), add a call simpleSizer.autoSizer(self) 4. remember you may need to make the app resizeable in the resource editor. I've tried it out on most of the Samples, as well as on findfiles (findfiles needed tweaking in the resourceEditor - the released version is not careful about the layout because the sizer code cleaned the layout up anyway. simpleSizer doesn't do that, so the layout needs to be correct in the resource file). Let me know if it works for you, or if it doesn't tell me how it goes wrong.. Thanks, -- Alex Tweedly http://www.tweedly.net |