|
|
|
|
|
Frames Aren't Interactive |
|
|
|
|
|
|
|
|
The frame widget itself is not interactive; by default, it can't accept input from the user. The widgets inside it can, but the frame cannot. As always, the focus ability is controlled by the -takefocus option: |
|
|
|
 |
|
|
|
|
-takefocus => 0 |
|
|
|
|
|
|
|
|
With a frame widget, it is set to 0. If for some reason you need to get input from the user on your frame, you will need to change it to -takefocus => 1. |
|
|
|
|
|
|
|
|
When you are running several applications at once and you start a web browser, you'll sometimes notice that the colors become corrupted. When you switch from an application to the browser, the colors in your other applications suddenly change. If you switch back from your browser to an application, the browser colors change. This is happening because the web browser is a color hog. It has requested more colors than the operating system can allocate at once. The OS must alter the colormap between applications to allow the active application to use the colors it wants to use. The colormap simply gives the operating system a way to keep track of who is using which colors. |
|
|
|
|
|
|
|
|
Perl/Tk applications can have many colors too-you can get color-happy and make each button a different color of the rainbow. This can cause problems if there are other applications running that want a lot of different colors too. If other applications are color hogs, Perl/Tk will switch to black-and-white mode. If you don't like this behavior, you can use the -colormap option to override it. -colormap takes either the word "new" or a reference to another window. If given "new", it will create its own colormap. When you use -colormap with another window, the two windows will share the colormap. But there is one catch, and that is the -visual option. |
|
|
|
|
|
|
|
|
The -visual option takes as an argument a string that contains a keyword and a number; for example: |
|
|
|
 |
|
|
|
|
-visual => "staticgrey 2" |
|
|
|
|
|
|
|
|
The keyword can be any one of the following: staticgrey, greyscale, static- color, pseudocolor, truecolor, or directcolor. The number indicates the depth of color used (2 = black/white). |
|
|
|
|
|
|
|
|
When you use -colormap to share the colormap between two windows, the -visual option for both must be the same. This means that -visual must be undef for both (the default) or it must have the same value. Neither -colormap nor -visual can be altered by using the configure method. |
|
|
|
|