Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transferring of pixels into mm

Status
Not open for further replies.

firelex

Programmer
Jan 10, 2002
118
DE
Hello, all!
My problem is:
I have a canvas and am trying to transfer pixel coordinates into mm. The point is: with the growing
number of pixels it gets rather complicated to figure out the exact number of mm from pixels.
The formula I use is
[tt]<number of pixels> / <number of pixel in mm>[/tt]

Is there any exacter one?

Thanks.
 
To get the pixels count from a mm count, see winfo pixels or winfo fpixels.
See:

To give mm lengthes in place of pixels lengthes you append m to the length (20m == 20 mm). See Tk_getPixels for more details.
From the Tk manual:
These procedures take as argument a specification of distance on the screen (objPtr or string) and compute the corresponding distance either in integer pixels or floating-point millimeters. In either case, objPtr or string specifies a screen distance as a floating-point number followed by one of the following characters that indicates units:

<none>
The number specifies a distance in pixels.
c
The number specifies a distance in centimeters on the screen.
i
The number specifies a distance in inches on the screen.
m
The number specifies a distance in millimeters on the screen.
p
The number specifies a distance in printer's points (1/72 inch) on the screen.

HTH

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top