[wxPython-users] how to get the screen size for an application

Christopher Barker Chris.Barker at noaa.gov
Thu Jan 4 10:06:19 PST 2007


krishnakant Mane wrote:

> well, the irony is that I am more comfortable with absolute positioning.
> the screen coordinates and the idea of pikcell is in my mentel 
> visualisation.
> I am just trying to make my job a bit easy.  for me having mastery
> over sizers would mean that I hav a sited assistant to help me out.

Your visual impairment certainly changes the situation for you, but when 
I read your previous mail it cemented my feeling that the way we 
naturally think is layout manager oriented -- not pixel coordinates. In 
your description of what you needed, I didn't read a single pixel 
coords, what I read was a discussion of how the widgets relate to 
each-other.

Here are some comments on what you wrote:

> there are 6 buttons at the bottom of the
> screen for new entry, update, save etc.

This is a vertical box sizer -- the 6 buttons on the bottom, the other 
controls on the top.

> now what I am doing is that
> having the entry fields in 2 columns which makes it 4 rows.

A GridSizer or FlexGridSizer.

> and at the bottom of the screen I will leave some space above the
> status bar and put buttons one next to other in a streight line

A Horizontal Box Sizer.

> leaving some space at the left and right of the frame and keeping
> proper distance between the buttons.

A spacer at each end -- and maybe in between the buttons, depending on 
what you want.

> in the columns above i will have the static text followed by the
> textbox and then some gap and again a static text and the text box for
> entry so the individual labels and text boxes are grouped and there is
> space before the other pare comes.
> in the same way all the 4 rows are arranged.

That's exactly what a Grid sizer is for. With absolute positioning, if 
you change one of the labels, ALL the positions need to change. With 
Sizers, this is taken care of for you.

This is a key point:

Sizers are often touted as being critical to accommodate different 
platforms, fonts, and languages (which they ARE!), but indeed, even if 
you are writing for one platform, language, and font size, Sizers are 
still very helpful in accommodating change in your layout as you go. 
Sure, it can be easier to do the layout by hand the first time, but once 
you need to change a label, add a button, etc, Sizers just take care of 
everything for you, with absolute positioning, you may need to change 
everything each time you make a small change to one thing. I know I 
NEVER have my design nailed down when I start -- does anyone?

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list