Copy of an e-mail sent to the pythoncard-users list - Simon Willison
Idea/suggestion for sizers
I don't know if this has been discussed before (I had a quick look through the archive but didn't spot anything like this) so here's my take on the sizer problem. At the moment, the position of components is defined in the resourceEditor as a co-ordinate relative to the top-left corner of the window. How about allowing the resourceEditor user to change the "point of reference" for a component to one of the other three corners? This would require a new property for components specifying which corner they are relative to, but could allow users to create basic resizable applications without having to dig in to the code.
As far as user interface goes I was thinking along the lines of the currently selected corner being highlighted, with the user clicking on different corners (or selecting them from a menu somewhere) to change the point of reference. To avoid confusion lines could be displayed on the canvas connecting the currently selected component to it's relative corners. I've created a couple of mockup screenshots to show this (they're hardly works of art but they should help demonstrate the idea):
The other interesting aspect of resizable applications is that some components should change their dimensions as the page is resized. Looking at the widgets available for PythonCard it strikes me that only a few components would actually need to be resizable:
- Gauge (possibly)
- Slider (possibly)
The simplest way of allowing a user to creat a resizable component would seem to be to allow the user to specify the component's dimensions as a percentage rather than a fixed width in pixels (similar to how tables and divs can be sized in HTML). I don't know how feasible it is to combine fixed-relative-to-corner positioning with take-up-as-90%-of-available-space positioning but from a resourceEditor user perspective thw two combined could create a very powerful but easy to use interface for creating resizable documents.
That said, one thing that would be nice in the absence of sizer support would be a "allow this application to be resized" option in the resourceEditor Background Info dialog. I'd love to turn off the user's ability to resize my application but I'm not confident enough to dive in and try to hard code this using native wxPython code.
Regards,
Simon