This file is indexed.

/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">&lt;&lt; Prev</A></TD><TD><A href="node6.html">- Up -</A></TD><TD><A href="node12.html#section.widgets-1.images">Next &gt;&gt;</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&nbsp;Tk<SPAN class="keyword">.</SPAN>label&nbsp;tkInit(parent:W&nbsp;bitmap:info)}<BR>L2={New&nbsp;Tk<SPAN class="keyword">.</SPAN>label&nbsp;tkInit(parent:W&nbsp;text:<SPAN class="string">'Labels:&nbsp;bitmaps&nbsp;and&nbsp;text'</SPAN>)}<BR>{Tk<SPAN class="keyword">.</SPAN>send&nbsp;pack(L1&nbsp;L2&nbsp;side:left&nbsp;padx:2<SPAN class="keyword">#</SPAN>m&nbsp;pady:2<SPAN class="keyword">#</SPAN>m)}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure&nbsp;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&nbsp;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&nbsp;tk(configure&nbsp;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&nbsp;tk(configure&nbsp;bitmap:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="string">'@'</SPAN><SPAN class="keyword">#</SPAN><SPAN class="string">'/usr/share/mozart/doc/wp/queen.xbm'</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreground:&nbsp;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&nbsp;3.4</A>. The program uses the grid geometry manager which is discussed in <A href="node17.html#section.geometry.grid">Section&nbsp;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&nbsp;[error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gray75&nbsp;gray50&nbsp;&nbsp;&nbsp;&nbsp;gray25&nbsp;&nbsp;&nbsp;gray12<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hourglass&nbsp;info&nbsp;&nbsp;&nbsp;questhead&nbsp;question&nbsp;warning]<BR>&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;I&nbsp;D}<BR>&nbsp;&nbsp;&nbsp;&nbsp;R=(I<SPAN class="keyword">-</SPAN>1)&nbsp;<SPAN class="keyword">div</SPAN>&nbsp;5&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;C=(I<SPAN class="keyword">-</SPAN>1)&nbsp;<SPAN class="keyword">mod</SPAN>&nbsp;5<BR>&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;{Tk<SPAN class="keyword">.</SPAN>batch&nbsp;[grid(row:R<SPAN class="keyword">*</SPAN>2&nbsp;&nbsp;&nbsp;column:C<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{New&nbsp;Tk<SPAN class="keyword">.</SPAN>label&nbsp;tkInit(parent:W&nbsp;bitmap:D)})<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grid(row:R<SPAN class="keyword">*</SPAN>2<SPAN class="keyword">+</SPAN>1&nbsp;column:C<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{New&nbsp;Tk<SPAN class="keyword">.</SPAN>label&nbsp;tkInit(parent:W&nbsp;text:D)})]}<BR>&nbsp;<SPAN class="keyword">end</SPAN>}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure&nbsp;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&nbsp;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&nbsp;[times&nbsp;helvetica&nbsp;courier]<BR>&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Family}<BR>&nbsp;&nbsp;&nbsp;&nbsp;{ForAll&nbsp;[normal&nbsp;bold]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Weight}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F={New&nbsp;Tk<SPAN class="keyword">.</SPAN>font&nbsp;&nbsp;tkInit(family:&nbsp;Family&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;weight:&nbsp;Weight&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size:&nbsp;&nbsp;&nbsp;12)}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L={New&nbsp;Tk<SPAN class="keyword">.</SPAN>label&nbsp;tkInit(parent:&nbsp;W<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text:&nbsp;&nbsp;&nbsp;<SPAN class="string">'A&nbsp;'</SPAN><SPAN class="keyword">#</SPAN>Weight<SPAN class="keyword">#</SPAN><SPAN class="string">'&nbsp;'</SPAN><SPAN class="keyword">#</SPAN>Family<SPAN class="keyword">#</SPAN><SPAN class="string">'&nbsp;font.'</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font:&nbsp;&nbsp;&nbsp;F)}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Tk<SPAN class="keyword">.</SPAN>send&nbsp;pack(L)}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}<BR>&nbsp;<SPAN class="keyword">end</SPAN>}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure&nbsp;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">&lt;&lt; Prev</A></TD><TD><A href="node6.html">- Up -</A></TD><TD><A href="node12.html#section.widgets-1.images">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>