Navigation Logo 11.6  Multiplatform Caveat Navigation Logo

 

 

As with the Tcl scripts, the Tk examples in this book have been tested on my two computers, one running Unix with X Windows and the other running Windows 95. As with the Tcl scripts, they run both places. However, several of them do not look the same on the screens of both windowing systems.

When I started this project, I thought the best way to proceed would be to set up all my displays using millimeters. After all, the number of pixels we get on our screens keeps going up but the size of a millimeter remains constant. Sure, Tk's idea of how big a millimeter is in the x or y direction is going to be inaccurate but, if the window is a little large or too small, so what?

This was naive. Tk's inaccurate idea of a millimeter can make a window too small to fill the minimum size in the Windows implementatation or too large to fit on a screen. In retrospect, this is not very surprising. Simply changing the screen driver can affect the accuracy of Tk's idea of a millimeter. Given the range of screen display possibilities, how could Tk be anywhere near close to the right value?

One conclusion from this discussion is that you may need to adjust the dimensions in some examples and exercises for use on your platform.

Another conclusion is that applications that will run on multiple platforms need some adaptive mechanism beyond what most examples in this book show.

An initialization process that determines two constants, X_Pixels (the number of pixels in a horizontal millimeter) and Y_Pixels (the number of pixels in a vertical millimeter), could be the basis for this adaptive mechanism. With these constants you could design your widgets in millimeters with the expectation that actual images would be close to your designs. One way to obtain approximations for these two constants is suggested in Exercise 15.11b.

On similar topics, be advised that some of the figures may appear in different sizes in this book than what you see on your screen. Also, be aware that you need not take exercises that specify exact sizes for widgets too seriously – use the suggested dimensions but do not worry if the result is a different size on your screen.

 

 

[Sample TK Application]
Author's Home Page
Navigation Logo [Book's Cover]
Order from Amazon.