[Sugar-devel] pixels to centimeters

Chris Leonard cjlhomeaddress at gmail.com
Mon Aug 13 09:52:40 EDT 2012


I would suggest looking at Walter's Ruler activity.  He may have
solved this issue for you.

http://activities.sugarlabs.org/en-US/sugar/addon/4192

cjl

2012/8/13 Flavio Danesse <fdanesse at gmail.com>:
> Hey.
>
> I'm trying to build a GUI for touch screen and want the widgets have certain
> dimensions in inches or millimeters, so I need to convert from pixels to
> centimeters or millimeters.
>
> So the query is:
>
> How do I convert pixels to centimeters?
>
> What I found on the web is about to 1 pixel measured 0.03 inches
> apromadamente, but in practice the numbers did not close.
>
> I tried doing something like this:
>
> gi import
> gi.repository import from GdkX11
>
>  screen = GdkX11.X11Screen()
>
> After which, with: screen.width () get the horizontal resolution 1366, which
> multiplied by 0.03 gives me 40.98 while my monitor actually measures 34.5
> cm.
>
> Another function of GdkX11: screen.width_mm () returns me 361 millimeters.
>
>
> Hola.
>
> Estoy intentando construir una interfaz gráfica para touch screen y quiero
> que los widgets tengan determinadas dimensiones en centímetros o milímetros,
> por lo cual necesito convertir de pixels a centímetros o a milímetros.
>
> De modo que la consulta es:
>
> ¿Cómo convierto pixels a centímetros?
>
> Lo que he encontrado en la web gira en torno a que 1 pixel mide
> apromadamente 0.03 centímetros, pero en la práctica los números no me
> cierran.
>
> He intentado hacer algo como esto:
>
> import gi
> from gi.repository import GdkX11
>
> screen = GdkX11.X11Screen()
>
> Luego de lo cual, con: screen.width() obtengo la resolución horizontal 1366,
> lo cual multiplicado por 0.03 me da 40.98 mientras que mi monitor mide en
> realidad 34.5 cm.
>
> Otra función de GdkX11: screen.width_mm() me devuelve 361 milímetros.
>
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>


More information about the Sugar-devel mailing list