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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<meta name="author" content="Dan Shafer">
<title>Font Dialog</title>
</head>
<body>
<h1>Font Dialog</h1>
<img src="images/dialogsfig6.png" alt="Find Dialog Sample"
width="437" height="344">
<br>
<br>
<h2>Creating the Dialog</h2>
Create a Font Dialog by calling dialog.fontDialog with one required
argument and one optional argument as shown in the following table:<br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="80%">
<tbody>
<tr>
<td valign="top"><b>Argument</b><br>
</td>
<td valign="top"><b>Data Type/Notes</b><br>
</td>
</tr>
<tr>
<td valign="top">self<br>
</td>
<td valign="top">the window (background) that is the parent for
the dialog<br>
</td>
</tr>
<tr>
<td valign="top">OPTIONAL aFont<br>
</td>
<td valign="top">Python dictionary containing a complete font description
to be used as the default starting point for the dialog. See description
of return value of "font" in table below for details.<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<b>Example:<br>
<br>
</b>Above dialog was created with this line of code:<br>
<br>
<code> result = dialog.fontDialog(self)<br>
</code> <br>
<h2>Interacting With the Dialog</h2>
The fontDialog component returns three values, stored as elements
of the Python dictionary called "results" returned by all PythonCard dialogs.
These results are as shown in the following table.<br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="50%">
<tbody>
<tr>
<td valign="top"><b>Name of value</b><br>
</td>
<td valign="top"><b>Description</b><br>
</td>
</tr>
<tr>
<td valign="top">accepted<br>
</td>
<td valign="top">True = user clicked OK<br>
False = user clicked Cancel<br>
</td>
</tr>
<tr>
<td valign="top">color<br>
</td>
<td valign="top">Tuple of three elements containing the red,
blue, and green values representing the color (i.e., RGB format)<br>
</td>
</tr>
<tr>
<td valign="top">font<br>
</td>
<td valign="top">Python dictionary object with keys style, faceName,
family, and size. All elements of dictionary are strings except for size,
which is an integer.<br>
</td>
</tr>
</tbody>
</table>
<br>
<b>Example:<br>
<br>
The sample dialog shown at the top of this page returns the following
results:<br>
<br>
</b>accepted: True<br>
color: (0, 0, 0)<br>
font: {'style': 'bold', 'faceName': 'Arial', 'family': 'sansSerif', 'size':
12}<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>
|