[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Percentage sizing/positioning of GUI widgets


I don't have a solution, or a direct response to your questions, but offer some related ideas to consider...

Have you seen grids?

Another way is to layout in say 320x200 and then scale everything from that.

Responsive design is about having different layouts at different resolutions.  Imagine a wide 1080p screen, and a narrow mobile phone screen.  They both have different aspect ratios, and number of pixels.  Using different layouts makes sense in that case.  So you might have your widgets one above the other horizontally in the phone view, but have them from left to right in the big screen view.  This is similar to the "media" attribute of style sheets where you can have a different style sheet for projectors, screens, or printers.


On Thu, Jul 26, 2012 at 12:32 PM, Sam Bull <sam.hacking@xxxxxxxx> wrote:
I'd like to ask for your thoughts on relative positioning/sizing of

So, I suppose the best case scenario is that you could assign a
percentage value to any rect attribute and it would automatically
resize/reposition when things change size.
        This might be too complicated, and actually rather unnecessary.

The key requirement is to keep widgets at a consistent size/position
when using different screen resolutions.

Do you think it would be acceptable to keep it limited to just setting
the pos attribute, without automatic repositioning?

So, you can set the pos attribute when creating the widget, or change it
later, and it will set it's position relative to the size of it's parent
or the screen. You can also set the size in the same way (though size
can only be set at creation time).

This would cover the use case of differing screen resolutions, using the
combination of percentage size and position.

My main question: what is the minimum requirements you would have for
relative positioning?