On Feb 24, 4:41 pm, Luis Zarrabeitia <ky...@uh.cu> wrote:
> On Tuesday 24 February 2009 07:12:36 pm Lionel wrote:
>
> > In a nutshell, what I need is a way to acquire the screen dimensions
> > (in pixels) and its dpi setting.
>
> This is a guess, and a guess only.
> What do you want to know it for? If it is for painting something on the
> screen, maybe (just maybe - I'm guessing here big time), whatever API you are
> using for painting can be used for getting the dimensions of the drawing
> device. I don't even know if GTK or Qt have that feature, but you should look
> into it. If the same api you will use for painting provides that
> functionality, then it would be kind of irrelevant if it is on the stdlib or
> not.
>
> Of course, this only applies if you want to paint and your api provides that
> info.
>
> --
> Luis Zarrabeitia (aka Kyrie)
> Fac. de Matemática y Computación, UH.http://profesores.matcom.uh.cu/~kyrie

Thanks for the responses so far, everyone. Luis you are indeed a good
guesser! I'm using wxPython/matplotlib and would like to size my
matplotlib data figure so that it assumes a 1:1 ratio on the screen
when embedded in a wxPython form. I'm playing with a 2D array with 320
rows and 177 columns and therefore would like to display the figure
with a size of 320x177 pixels. The problem is that the call to
instantiate the figure takes size parameters of inches and dpi! For
example:

matplotlib.figure.Figure((5,4), 75)

is a figure with width of 5 inches, height of 4 inches, and dpi of 75.
Thanks to Luis' comment I googled around and found that wxPython has
the following functions:

wx.GetDisplaySize()    # Get dimensions in pixels.
wx.GetDisplaySizeMM()  # Get dimensions in millimeters.

It's a little klunky to have a function that takes inches an an
argument and another that produces millimeters when querying the
display, no? Unless someone has a better idea I suppose I'll have to
convert between the two to display at 1:1.

-L

SInce I want my matplotlib.figure.Figure() to assume the exact pixel
dimensions of the 2D array,
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to