/usr/share/mozart/doc/wp/node11.html is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>3.5 Label Widgets</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node10.html#section.widgets-1.hierarchy"><< Prev</A></TD><TD><A href="node6.html">- Up -</A></TD><TD><A href="node12.html#section.widgets-1.images">Next >></A></TD></TR></TABLE><DIV id="section.widgets-1.label"><H2><A name="section.widgets-1.label">3.5 Label Widgets</A></H2><P> A <A name="label99"></A><EM>label</EM> widget displays a text string or a bitmap. Options for frames are also valid options for labels, additional options determine what the label displays. The reference documentation for labels is <A href="../tcltk/TkCmd/label.htm"><KBD>label</KBD></A>. </P><P> </P><DIV id="figure.widgets-1.labels"><HR><P><A name="figure.widgets-1.labels"></A></P><P> </P><DIV align="center"><IMG alt="" src="labels.gif"></DIV><P> <A name="label101"></A> </P><DL class="anonymous"><DD class="code"><CODE>L1={New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:W bitmap:info)}<BR>L2={New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:W text:<SPAN class="string">'Labels: bitmaps and text'</SPAN>)}<BR>{Tk<SPAN class="keyword">.</SPAN>send pack(L1 L2 side:left padx:2<SPAN class="keyword">#</SPAN>m pady:2<SPAN class="keyword">#</SPAN>m)}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure 3.3:</STRONG> Example for labels displaying bitmaps and text.</P><HR></DIV><P> </P><P> <A href="node11.html#figure.widgets-1.labels">Figure 3.3</A> shows an example where the label <CODE>L1</CODE> displays a bitmap and the label <CODE>L2</CODE> displays text. As with other widgets, the options of a label widget can be reconfigured by sending the widget object a <CODE>tk</CODE> message with the command <CODE>configure</CODE>. Execution of the following expression changes the bitmap to an exclamation mark: </P><DL class="anonymous"><DD class="code"><CODE>{L1 tk(configure bitmap:warning)}</CODE></DD></DL><P> </P><DIV id="section.widgets-1.bitmap"><H3><A name="section.widgets-1.bitmap">3.5.1 Bitmap Options</A></H3><P> Label widgets and several other widgets allow to display <A name="label102"></A>bitmaps. There are two different kinds of bitmaps: predefined bitmaps and bitmaps stored in files. </P><P> If the first character of the <CODE>bitmap</CODE> option value is an <CODE>@</CODE>, the value is interpreted as filename. For instance, feeding <A name="label104"></A> </P><DL class="anonymous"><DD class="code"><CODE>{L2 tk(configure bitmap: <SPAN class="string">'@'</SPAN><SPAN class="keyword">#</SPAN><SPAN class="string">'/usr/share/mozart/doc/wp/queen.xbm'</SPAN> <BR> foreground: orange)}</CODE></DD></DL><P> displays a bitmap stored in a file. </P><DIV class="apropos"><P class="margin">predefined bitmaps</P><P> If the first character is different from <CODE>@</CODE>, it is interpreted as the name of a predefined bitmap. A program that displays all predefined bitmaps and their names you can see in <A href="node11.html#figure.widgets-1.predefined">Figure 3.4</A>. The program uses the grid geometry manager which is discussed in <A href="node17.html#section.geometry.grid">Section 4.3</A>. </P></DIV><P> </P><DIV id="figure.widgets-1.predefined"><HR><P><A name="figure.widgets-1.predefined"></A></P><P> </P><DIV align="center"><IMG alt="" src="predefined.gif"></DIV><P> </P><DL class="anonymous"><DD class="code"><CODE>{List<SPAN class="keyword">.</SPAN>forAllInd [error gray75 gray50 gray25 gray12<BR> hourglass info questhead question warning]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> I D}<BR> R=(I<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">div</SPAN> 5 <BR> C=(I<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">mod</SPAN> 5<BR> <SPAN class="keyword">in</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>batch [grid(row:R<SPAN class="keyword">*</SPAN>2 column:C<BR> {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:W bitmap:D)})<BR> grid(row:R<SPAN class="keyword">*</SPAN>2<SPAN class="keyword">+</SPAN>1 column:C<BR> {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:W text:D)})]}<BR> <SPAN class="keyword">end</SPAN>}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure 3.4:</STRONG> Predefined bitmaps.</P><HR></DIV><P> </P><DIV class="apropos"><P class="margin">bitmap colors</P><P> Bitmaps have two colors. These colors can be configured with the <CODE>foreground</CODE> and <CODE>background</CODE> options. The color of the bitmaps' pixels is given by the foreground color. </P></DIV></DIV><DIV id="section.widgets-1.fonts"><H3><A name="section.widgets-1.fonts">3.5.2 Font Options</A></H3><P><A name="label106"></A> <A name="label107"></A>A font to be used for displaying text can be specified by the <CODE>font</CODE> option. Valid values for the <CODE>font</CODE> option are either platform specific font names or instances of the class <CODE>Tk<SPAN class="keyword">.</SPAN>font</CODE>. An instance of the class <CODE>Tk<SPAN class="keyword">.</SPAN>font</CODE> is also a tickle object but is not a widget. </P><P> <A name="label108"></A>Platform dependent font names are for example X font names. If you are running a Unix based system, you can for example display the available names by using the <KBD>xlsfonts</KBD> program. </P><P> However the preferred way to specify fonts is to be platform independent of course. The program in <A href="node11.html#figure.widgets-1.fonts">Figure 3.5</A> uses this technique. </P><P> </P><DIV id="figure.widgets-1.fonts"><HR><P><A name="figure.widgets-1.fonts"></A></P><P> </P><DIV align="center"><IMG alt="" src="fonts.gif"></DIV><P> </P><DL class="anonymous"><DD class="code"><CODE>{ForAll [times helvetica courier]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> Family}<BR> {ForAll [normal bold]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> Weight}<BR> F={New Tk<SPAN class="keyword">.</SPAN>font tkInit(family: Family <BR> weight: Weight <BR> size: 12)}<BR> L={New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent: W<BR> text: <SPAN class="string">'A '</SPAN><SPAN class="keyword">#</SPAN>Weight<SPAN class="keyword">#</SPAN><SPAN class="string">' '</SPAN><SPAN class="keyword">#</SPAN>Family<SPAN class="keyword">#</SPAN><SPAN class="string">' font.'</SPAN> <BR> font: F)}<BR> <SPAN class="keyword">in</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack(L)}<BR> <SPAN class="keyword">end</SPAN>}<BR> <SPAN class="keyword">end</SPAN>}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure 3.5:</STRONG> Example for different fonts.</P><HR></DIV><P> </P><P> The init message for creating a font determines with the options <A name="label110"></A><CODE>family</CODE> (the style of the font), <A name="label112"></A><CODE>weight</CODE> (whether it is bold or normal), and <A name="label114"></A><CODE>size</CODE> (how large is the font in point, if the number is positive, in pixels if it is less than zero) how the font looks. <CODE>Tk<SPAN class="keyword">.</SPAN>font</CODE> supports more options, for a complete overview consult <A href="../tcltk/TkCmd/font.htm"><KBD>font</KBD></A>. </P><P> Regardless of the platform, the families <CODE>courier</CODE>, <CODE>times</CODE>, and <CODE>helvetica</CODE> are supported. </P></DIV></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node10.html#section.widgets-1.hierarchy"><< Prev</A></TD><TD><A href="node6.html">- Up -</A></TD><TD><A href="node12.html#section.widgets-1.images">Next >></A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~schulte/">Christian Schulte</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|