From: John H. <ec...@ya...> - 2007-11-04 19:05:51
|
--- Hugh Kernohan <ma...@hu...> wrote: > I found PythonCard some time ago while looking for a > way to write 'real > programmes' for Windows. Its simplicity and logical > structure appealed > to me. Through it I have learnt a huge amount about > both Python and > wxWidgets. In particular the ability to adapt, > amend and extend the > tools is very satisfying. > Agree. > Like others I found the inability to use sizers > easily was a drawback. > Not so much of a drawback as to make me want to > learn C++ and code in > wxWidgets, or to give up PythonCard, but at the same > time I objected to > mixing programmatic generation of sizers into my > code - it is also a > hard way to learn. > Out of necessity, I've gotten pretty good in using wx sizers with Pythoncard. It's definitely usable but as you said, it's a hard way to learn. Besides, it's really hard sometimes to try to figure out why things don't turn out the way I am expecting it to. > Inspiration for a solution came with Alex Tweedly's > simplesizer and I > set off with the aim of making sizers work for > PythonCard while > maintaining what seem to be its two key > characteristics: the separation > of layout and processing, and the use of visual > drag-and-drop tools for > layout. A secondary aim was to develop the routines > in a way which did > not break existing tools or code. > Very noble goals. :-) > I now have something which is firmly an alpha > version and a work in > progress, but it does work in several regards. I'd > be happy to share my > code for comment and improvement but the mailing > list rejected the zip > file (even if it was only 106Kb). So I'd be glad if > someone could > explain how to get round that. > May be the Pythoncard developers can help, or may be we can start an eGroup at Yahoo on Pythoncard. > The elements are: > (a) additions to the existing Layout Editor to > create a visual Sizer > Editor which manipulates sizers and allows > components to be dropped into > them and re-arranged at will; the effect of > different settings can be > seen immediately; Obvious place to do it. Unfortunately it also means I have to rely on the Layout Editor more. I have reported problems with the Layout Editor long ago but there hasn't been any fix to it yet. As it stands, I can only use the Layout Editor in *very* simplistic fashion: get the basic layout done, switch to editor to edit the resource file, and switch back to layout editor to show the work and so on... We need to fix the layout editor!!! > (b) the final sizer details are saved into the > current .rsrc.py file; Of course. > (b) a short routine, called autoSizer, which > processes the sizer data in > the .rsrc file when a main application is > initialized. > > The routines handle BoxSizers, GridSizers and > StaticBoxSizers; > FlexGridSizers are implemented but I am not 100% > convinced I've got them > right. The biggest omission is the ability to > override manually the > sizer engine's calculation of minimum dimensions for > components. > > There is an option to ease the conversion of > existing .rsrc.py layouts > to a sizer-based format. A menu option creates a > single vertical sizer > containing all the components in the .rsrc file > (effectively an > on-screen list). You can then define your desired > sizer configuration > and drag and drop the components into the right > places. Eventually the > temporary vertical sizer can be deleted when it is > empty. Slightly > tedious but it works and it beats re-typing all your > components. > > I have had trouble with setting minimum sizes, so > I've parked that for > now. I have also yet to master re-drawing the > screen properly, dealing > with the sizing handles when they get misplaced, and > the impact of the > MenuBar on the editor display. Nor have I tested > the interaction of my > sizer-based solutions with all the elements of > Layout Editor, especially > multiple selections. The GridBagSizer is a joy to > come, as are global > and multiple edits of sizers, drag-and-drop in the > sizer tree etc, etc! > > Thanks, Hugh Kernohan > > I am on a tight time schedule for now but I hope I can of use beta testing the code during X'mas holidays. Thanks for the effort, though. Any improvements to PythonCard is very much welcomed. -- John Henry |