/usr/share/doc/python-gtk2-tutorial/html/sec-FontSelectionDialog.html is in python-gtk2-tutorial 2.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>9.15. Font Selection Dialog</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Tutorial"><link rel="up" href="ch-MiscellaneousWidgets.html" title="Chapter 9. Miscellaneous Widgets"><link rel="previous" href="sec-FileSelections.html" title="9.14. File Selections"><link rel="next" href="ch-ContainerWidgets.html" title="Chapter 10. Container Widgets"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">9.15. Font Selection Dialog</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-FileSelections.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Miscellaneous Widgets</th><td width="20%" align="right"> <a accesskey="n" href="ch-ContainerWidgets.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-FontSelectionDialog"></a>9.15. Font Selection Dialog</h2></div></div><div></div></div><p>The Font Selection Dialog allows a user to interactively select
a font for use within your program. The dialog contains a
<tt class="classname">FontSelection</tt> widget and <span class="guibutton">OK</span>
and <span class="guibutton">Cancel</span> buttons. An <span class="guibutton">Apply</span>
button is also available in the dialog but is initially hidden. The Font
Selection Dialog allows a user to select a font from the available system
fonts (the same ones that can be retrieved using
<span><b class="command">xlsfonts</b></span>).</p><p><a href="sec-FontSelectionDialog.html#fontselfig" title="Figure 9.15. Font Selection Dialog">Figure 9.15, “Font Selection Dialog”</a> illustrates the
<tt class="classname">FontSelectionDialog</tt> display:</p><div class="figure"><a name="fontselfig"></a><p class="title"><b>Figure 9.15. Font Selection Dialog</b></p><div class="mediaobject" align="center"><img src="figures/fontselection.png" align="middle" alt="Font Selection Dialog"></div></div><p>The dialog contains a set of three notebook pages that
provide:</p><div class="itemizedlist"><ul type="disc"><li><p>an interface to select the font, font style and font
size</p></li><li><p>detailed information about the currently selected font</p></li><li><p>an interface to the font filter mechanism that restricts the
fonts available for selection</p></li></ul></div><p>The function to create a
<tt class="classname">FontSelectionDialog</tt> is:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
fontseldlg = gtk.FontSelectionDialog(<b class="parameter"><tt>title</tt></b>)
</pre></td></tr></table><p>The <i class="parameter"><tt>title</tt></i> is a string that will be used to
set the titlebar text.</p><p>A Font Selection Dialog instance has several attributes:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
fontsel
main_vbox
action_area
ok_button
apply_button
cancel_button
</pre></td></tr></table><p>The <i class="parameter"><tt>fontsel</tt></i> attribute provides a
reference to the Font Selection widget.<i class="parameter"><tt> main_vbox</tt></i> is
a reference to the <tt class="classname">gtk.VBox</tt> containing the
<i class="parameter"><tt>fontsel</tt></i> and the <i class="parameter"><tt>action_area</tt></i> in
the dialog. The <i class="parameter"><tt>action_area</tt></i> attribute is a reference
to the <tt class="classname">gtk.HButtonBox</tt> that contains the
<span class="guibutton">OK</span>, <span class="guibutton">Apply</span> and
<span class="guibutton">Cancel</span> buttons. The <i class="parameter"><tt>ok_button</tt></i>,
<i class="parameter"><tt>cancel_button</tt></i> and <i class="parameter"><tt>apply_button</tt></i>
attributes provide references to the <span class="guibutton">OK</span>,
<span class="guibutton">Apply</span> and <span class="guibutton">Cancel</span> buttons that
can be used to set connections to the button signals. The
<i class="parameter"><tt>apply_button</tt></i> reference can also be used to
<tt class="methodname">show</tt>() the <span class="guibutton">Apply</span>
button.</p><p>You can set the initial font to be displayed in the
<i class="parameter"><tt>fontseldlg</tt></i> by using the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
fontseldlg.set_font_name(<b class="parameter"><tt>fontname</tt></b>)
</pre></td></tr></table><p>The <i class="parameter"><tt>fontname</tt></i> argument is the name of a
completely specified or partially specified system font. For example:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
fontseldlg.set_font_name('-adobe-courier-bold-*-*-*-*-120-*-*-*-*-*-*')
</pre></td></tr></table><p>partially specifies the initial font.</p><p>The font name of the currently selected font can be retrieved
using the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
font_name = fontseldlg.get_font_name()
</pre></td></tr></table><p>The Font Selection Dialog has a Preview area that displays text
using the currently selected font. The text that is used in the Preview area
can be set with the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
fontseldlg.set_preview_text(<b class="parameter"><tt>text</tt></b>)
</pre></td></tr></table><p>The preview text can be retrieved with the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
text = fontseldlg.get_preview_text()
</pre></td></tr></table><p>The <a href="examples/calendar.py" target="_top"><span><b class="command">calendar.py</b></span></a> example
program uses a Font Selection Dialog to select the font to display the
calendar information. Lines 105-110 define a callback that retrieves the
font name from the Font Selection Dialog and uses it to set the font for the
calendar widget. Lines 112-131 defines the method that creates the Font
Selection Dialog, sets up the callbacks for the <span class="guibutton">OK</span>
and <span class="guibutton">Cancel</span> buttons and displays the dialog.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-FileSelections.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-MiscellaneousWidgets.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch-ContainerWidgets.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.14. File Selections </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Container Widgets</td></tr></table></div></body></html>
|