From: Alex T. <ale...@us...> - 2005-08-13 14:39:50
|
Update of /cvsroot/pythoncard/PythonCard/docs/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15646 Modified Files: resource_editor_overview.html timers-threads.html Log Message: Updated to be current to PythonCard 0.8.1 Index: timers-threads.html =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/timers-threads.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** timers-threads.html 26 Jul 2004 15:35:32 -0000 1.2 --- timers-threads.html 13 Aug 2005 14:39:41 -0000 1.3 *************** *** 14,18 **** <h2>Increasing Usefulness:Talking to program back-ends with Timers and Threads</h2> ! <h4>by David McNab</h4> <p>This walkthrough supplements the excellent existing PythonCard 'Getting Started' <a href="documentation.html">walkthroughs</a> by Dan Shafer and --- 14,18 ---- <h2>Increasing Usefulness:Talking to program back-ends with Timers and Threads</h2> ! <h4>by David McNab and Alex Tweedly.</h4> <p>This walkthrough supplements the excellent existing PythonCard 'Getting Started' <a href="documentation.html">walkthroughs</a> by Dan Shafer and *************** *** 20,29 **** Add a child window</a> lesson. It's based on techniques taken from the various PythonCard <a href="/samples/samples.html">sample programs</a>.</p> <hr /> <h3>Overview, Scope and Purpose</h3> ! <p><em>This walkthrough is targeted at PythonCard Version 0.7. As PythonCard grows, some of this walkthrough may go out of date, even fail - if this ! happens, please contact <strong>david at rebirthing dot co dot nz</strong>, ! and I'll update it.</em></p> <p>The purpose of this walkthrough is to empower you to make your PythonCard programs capable of much more meaningful work, by acquainting you with two --- 20,33 ---- Add a child window</a> lesson. It's based on techniques taken from the various PythonCard <a href="/samples/samples.html">sample programs</a>.</p> + <p>This walkthrough was originally written by David McNab + (<strong>david at rebirthing dot co dot nz</strong>), and was revised by, + and is currently maintained by, Alex Tweedly + (<strong>alex at tweedly dot net</strong>) <hr /> <h3>Overview, Scope and Purpose</h3> ! <p><em>This walkthrough is targeted at PythonCard Version 0.8.1. ! As PythonCard grows, some of this walkthrough may go out of date, even fail - if this ! happens, please contact me and I'll update it.</em></p> <p>The purpose of this walkthrough is to empower you to make your PythonCard programs capable of much more meaningful work, by acquainting you with two *************** *** 60,64 **** will automatically add 10 to the number in the counter field, doing this every 5 seconds.</p> ! <p>Firstly, you will need to add an <span class="code">on_openBackground </span> event handler to your main window. You may have already done this, while experimenting in your learning process during the earlier walkthroughs. --- 64,68 ---- will automatically add 10 to the number in the counter field, doing this every 5 seconds.</p> ! <p>Firstly, you will need to add an <span class="code">on_initialize </span> event handler to your main window. You may have already done this, while experimenting in your learning process during the earlier walkthroughs. *************** *** 66,103 **** <span class="code">Counter</span> class:</p> <p class="code"> ! def on_openBackground(self, event):<br /> ! print "Window opened"</p> <p>Not very significant - but do save your file, and run <span class="code"> counter.py</span>. You'll see a message on stdout when the window opens.</p> <p>So far, so good. Nice to know that we can receive an event when the window gets opened. But not very useful yet.</p> ! <p>Now, we need to use this <span class="code">openBackground</span> event handler as an opportunity to set up a timer.</p> <p>So change the event handler to the following:</p> <p class="code"> ! def on_openBackground(self, event):<br /> ! self.myTimer = wx.wxTimer(self.components.field1, -1) # create a timer<br /> ! self.myTimer.Start(5000) # launch timer, to fire every 5000ms (5 seconds)</p> ! <p>Here, we're making recourse to the wxPython classes underlying PythonCard. ! We need to do this because PythonCard doesn't yet have its own timer wrappers. ! You'll also notice from the <span class="code">self.components.field1</span> that the timer is being created in respect of the <span class="code">field1</span> widget. More on this later.</p> ! <p>Don't try to run this program yet - it will barf since <span class="code">wx</span> ! is an unknown symbol - we need to grab it into our namespace. To do this, add ! to the top of your <span class="code">counter.py</span> program the ! following:</p> ! <p class="code">from wxPython import wx</p> ! <p>so that <span class="code">wx</span> is a known symbol.</p> <p>Now, we have to make sure we can receive an event every time the clock 'ticks'.</p> ! <p>You'll see in the <span class="code">on_openBackground</span> event handler above that we've linked the timer to <span class="code">field1</span> While conceptually the timer applies to the window as a whole, there's a ! weird quirk in <span class="code">wx</span> which requires timers to be ! associated with specific window widgets. So we'll just appease ! <span class="code">wx</span> and get on with the job.</p> <p>To receive the clock tick events, we only have to add another handler.</p> <p>As per the event handler naming convention, (where widgets' handlers --- 70,105 ---- <span class="code">Counter</span> class:</p> <p class="code"> ! def on_initialize(self, event):<br /> ! print "Window opened"</p> <p>Not very significant - but do save your file, and run <span class="code"> counter.py</span>. You'll see a message on stdout when the window opens.</p> <p>So far, so good. Nice to know that we can receive an event when the window gets opened. But not very useful yet.</p> ! <p>Now, we need to use this <span class="code">initialize</span> event handler as an opportunity to set up a timer.</p> <p>So change the event handler to the following:</p> <p class="code"> ! def on_initialize(self, event):<br /> ! self.myTimer = timer.Timer(self.components.field1, -1) # create a timer<br /> ! self.myTimer.Start(5000) # launch timer, to fire every 5000ms (5 seconds)</p> ! <p>You'll also notice from the <span class="code">self.components.field1</span> that the timer is being created in respect of the <span class="code">field1</span> widget. More on this later.</p> ! <p>Don't try to run this program yet - it will barf since <span class="code">timer</span> ! is an unknown symbol - we need to grab it into our namespace. To do this, find ! the line at the top of your <span class="code">counter.py</span> program ! which currently says</p> ! <p class="code">from PythonCard import model</p> ! <p>and change it to say</p> ! <p class="code">from PythonCard import model, timer</p> <p>Now, we have to make sure we can receive an event every time the clock 'ticks'.</p> ! <p>You'll see in the <span class="code">on_initialize</span> event handler above that we've linked the timer to <span class="code">field1</span> While conceptually the timer applies to the window as a whole, there's a ! weird quirk in <span class="code">timers</span> which requires them to be ! associated with specific window widgets.</p> <p>To receive the clock tick events, we only have to add another handler.</p> <p>As per the event handler naming convention, (where widgets' handlers *************** *** 109,120 **** Counter</span>:</p> <p class="code"> ! def on_field1_timer(self, event):<br /> ! print "Got a timer event"<br /> ! startValue = int(self.components.field1.text)<br /> ! endValue = startValue + 10<br /> ! print "Got a timer event, value is now %d" % endValue<br /> ! self.components.field1.text = str(endValue)<br /> ! # uncomment the line below if you've already followed the 'child window' walkthrough<br /> ! #self.minimalWindow.components.field1.text = str(endValue)</p> <p><em>Note</em> - this is ugly, because there's a lot of duplicated functionality. We'll leave it to you to factorise your code appropriately, --- 111,122 ---- Counter</span>:</p> <p class="code"> ! def on_field1_timer(self, event):<br /> ! print "Got a timer event"<br /> ! startValue = int(self.components.field1.text)<br /> ! endValue = startValue + 10<br /> ! print "Got a timer event, value is now %d" % endValue<br /> ! self.components.field1.text = str(endValue)<br /> ! # uncomment the line below if you've already followed the 'child window' walkthrough<br /> ! #self.minimalWindow.components.field1.text = str(endValue)</p> <p><em>Note</em> - this is ugly, because there's a lot of duplicated functionality. We'll leave it to you to factorise your code appropriately, *************** *** 158,162 **** <p>The first thing you could do is disable the timer you set up in the previous section, by commenting out the <span class="code">self.myTimer.Start(5000)</span> ! statement in your <span class="code">on_openBackground</span> handler (see above). This will avoid confusion for now, since there won't be a running timer to complicate things.</p> --- 160,164 ---- <p>The first thing you could do is disable the timer you set up in the previous section, by commenting out the <span class="code">self.myTimer.Start(5000)</span> ! statement in your <span class="code">on_initialize</span> handler (see above). This will avoid confusion for now, since there won't be a running timer to complicate things.</p> *************** *** 195,199 **** global function, not a class method. This thread will periodically sends messages to our window</li> ! <li>In your <span class="code">on_openBackground</span> handler, launch your thread and pass it a handle to the message queue.</li> <li>Add an <strong>idle</strong> event handler, which picks up these --- 197,201 ---- global function, not a class method. This thread will periodically sends messages to our window</li> ! <li>In your <span class="code">on_initialize</span> handler, launch your thread and pass it a handle to the message queue.</li> <li>Add an <strong>idle</strong> event handler, which picks up these *************** *** 203,207 **** </ol> <h4>1. Add the message queue</h4> ! <p>Refer back to the <span class="code">on_openBackground(self, event)</span> handler above, and add the following statement:</p> <p class="code"> --- 205,209 ---- </ol> <h4>1. Add the message queue</h4> ! <p>Refer back to the <span class="code">on_initialize(self, event)</span> handler above, and add the following statement:</p> <p class="code"> *************** *** 230,234 **** x += 10</p> <h4>3. Launch the Thread</h4> ! <p>Add the following lines at the end of your <span class="code">on_openBackground</span> handler:</p> <p class="code"> --- 232,236 ---- x += 10</p> <h4>3. Launch the Thread</h4> ! <p>Add the following lines at the end of your <span class="code">on_initialize</span> handler:</p> <p class="code"> *************** *** 293,297 **** skill.</p> <p>Happy programming!</p> ! <p>Copyright (c) 2003 by David McNab, david at rebirthing dot co dot nz. Please feel free to mirror, copy, translate, upgrade and restribute this page, as long as you keep up to date with Python and PythonCard, and credit the --- 295,300 ---- skill.</p> <p>Happy programming!</p> ! <p>Copyright (c) 2003 by David McNab, david at rebirthing dot co dot nz<br> ! Copyright (c) 2005 by Alex Tweedly, alex at tweedly dot net<br> Please feel free to mirror, copy, translate, upgrade and restribute this page, as long as you keep up to date with Python and PythonCard, and credit the Index: resource_editor_overview.html =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/resource_editor_overview.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** resource_editor_overview.html 26 Jul 2004 15:35:31 -0000 1.3 --- resource_editor_overview.html 13 Aug 2005 14:39:41 -0000 1.4 *************** *** 3,7 **** <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> ! <meta name="author" content="Dan Shafer" /> <link rel="stylesheet" href="PythonCard.css" type="text/css" /> <title>PythonCard's resourceEditor: An Overview</title> --- 3,7 ---- <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> ! <meta name="author" content="Dan Shafer + Alex Tweedly" /> <link rel="stylesheet" href="PythonCard.css" type="text/css" /> <title>PythonCard's resourceEditor: An Overview</title> *************** *** 16,23 **** <p>This document describes the resourceEditor which is used to design, lay out, and manipulate PythonCard applications' graphical components. ! It is current as of Version 0.6.7 of the PythonCard release, but given the ! state of flux in which PythonCard finds itself, you should expect the ! behavior of the resourceEditor to change between now and the 1.0 release of ! the product.</p> <p>This document is not so much about how to <em>use</em> the resourceEditor as it is an operational reference overview of the functionality it contains. --- 16,22 ---- <p>This document describes the resourceEditor which is used to design, lay out, and manipulate PythonCard applications' graphical components. ! It is current as of Version 0.8.1 of the PythonCard release; you should ! expect only minor changes in the behavior of the resourceEditor to ! change between now and release 1.0 of the product.</p> <p>This document is not so much about how to <em>use</em> the resourceEditor as it is an operational reference overview of the functionality it contains. *************** *** 27,40 **** to what you would consider a tutorial.</p> <p> For the most part, this discussion confines itself to the use of the ! resourceEditor in building applications on Windows platforms designed to ! run on Windows platforms. But PythonCard can be used on *nix systems and ! a version for Macintosh OS X is in beta test as this is being written. ! Applications written in PythonCard will be able to run on all of those ! systems unchanged once the deployment of wxPython (the cross-platform ! windowing toolkit on which PythonCard is based) is complete on all of those ! platforms.</p> <h2>Overview of resourceEditor</h2> <p>The resourceEditor is located in the tools directory of the PythonCard ! distribution.</p> <p>The resourceEditor is the most common starting point for constructing a PythonCard application. Using this tool, you can create, position, size, --- 26,38 ---- to what you would consider a tutorial.</p> <p> For the most part, this discussion confines itself to the use of the ! resourceEditor in building applications on Windows platforms. But ! PythonCard can also be used on *nix systems and Macintosh OS X. ! </p> <h2>Overview of resourceEditor</h2> <p>The resourceEditor is located in the tools directory of the PythonCard ! distribution. There is also an experimental version of the resourceEditor ! which presents the component properties in a very different format ! and allows a variety of operations on multiple components; ! this is in the same directory, but called multiresourceEditor.</p> <p>The resourceEditor is the most common starting point for constructing a PythonCard application. Using this tool, you can create, position, size, *************** *** 49,57 **** allow you to choose your favorite Python script editor to write the code that gives your application its intelligence and behavior. (We would ! recommend you look at the codeEditor sample application that comes with PythonCard. It is a very capable Python-aware editor and its source is available so you can change it to suit your tastes.)</p> <h3>The 10,000-Foot View of PythonCard Application Development</h3> ! <p>All PythonCard applications have at least two basic files.</p> <p>One file, which has a double file extension of ".rsrc.py" and is referred to as the "resource file", describes the user interface --- 47,57 ---- allow you to choose your favorite Python script editor to write the code that gives your application its intelligence and behavior. (We would ! recommend you look at the codeEditor application that comes with PythonCard. It is a very capable Python-aware editor and its source is available so you can change it to suit your tastes.)</p> <h3>The 10,000-Foot View of PythonCard Application Development</h3> ! <p>Most PythonCard applications have at least two basic files. It is ! possible to build a PythonCard application in a single file, see the ! "noresource" sample in the samples directory.</p> <p>One file, which has a double file extension of ".rsrc.py" and is referred to as the "resource file", describes the user interface *************** *** 65,69 **** <p>The second file is a standard Python script file ending with the extension .py (or .pyw depending on how you want it executed). It contains the code ! your application executes. This code of event-triggered methods and commands that will be executed as the user interacts with your PythonCard application.</p> --- 65,69 ---- <p>The second file is a standard Python script file ending with the extension .py (or .pyw depending on how you want it executed). It contains the code ! your application executes. This code consists of event-triggered methods and commands that will be executed as the user interacts with your PythonCard application.</p> *************** *** 117,124 **** <h3>The resourceEditor's User Interface</h3> <p>In its default configuration "out of the box," the ! resourceEditor, when you launch it, will open three windows plus a console ! window. The three windows are:</p> <ul> ! <li>the Template Resource window (see Figure 1), which is the default window in which you will begin constructing your UI unless you elect to open an existing resource file</li> --- 117,125 ---- <h3>The resourceEditor's User Interface</h3> <p>In its default configuration "out of the box," the ! resourceEditor, when you launch it, will open two windows plus a console ! window. The two windows are:</p> <ul> ! <li>the Standard Template with File->Exit Resource window (see Figure 1), ! which is the default window in which you will begin constructing your UI unless you elect to open an existing resource file</li> *************** *** 126,149 **** things as fonts, colors, sizes, positions, labels, names, and other details describing each component you add to the application's window</li> - <li>the read-only Position & Size window (Figure 3) which you can - use to assist you in placing components in the window</li> </ul> ! <p>The Property Editor window and the Position & Size window always ! reflect information about the currently selected component in the resource ! window.</p> ! <p class="imageCaption"><img src="images/resEditorFig1.png" alt="resourceEditor default resource window" width="402" height="294" /><br /> Figure 1. Default Resource Window in resourceEditor</p> ! <p class="imageCaption"><img src="images/resEditorFig2.png" alt="Property Editor Window" width="360" height="240" /><br /> Figure 2. Blank Property Editor Window (No Component Selected)</p> - <p class="imageCaption"><img src="images/resEditorFig3.png" alt="Size & Position Window" width="196" height="68" /><br /> - Figure 3. Blank Position & Size Window (No Component Selected)</p> <p>When you wish to edit elements of the user interface for which the resourceEditor does not automatically open a window, you will encounter two other windows: the menu editor and the background editor, shown, ! respectively, in Figures 4 and 5.</p> ! <p class="imageCaption"><img src="images/resEditorFig4.png" alt="background editor window" width="370" height="355" /><br /> ! Figure 4. Background Info Editor Window<br/> ! <img src="images/resEditorFig5.png" alt="menu editor window" width="480" height="300" /><br /> ! Figure 5. Menu Editor Window<br /></p> <p>We will look at each of these windows in greater detail in subsequent sections of this document.</p> --- 127,152 ---- things as fonts, colors, sizes, positions, labels, names, and other details describing each component you add to the application's window</li> </ul> ! <p>The Property Editor window always ! reflects information about the currently selected component in the resource ! window, including showing the size and position of the selected component ! in its status bar.</p> ! <p class="imageCaption"><img src="images/resEditorFig1.png" alt="resourceEditor default resource window" /><br /> Figure 1. Default Resource Window in resourceEditor</p> ! <p class="imageCaption"><img src="images/resEditorFig2.png" alt="Property Editor Window" /><br /> Figure 2. Blank Property Editor Window (No Component Selected)</p> <p>When you wish to edit elements of the user interface for which the resourceEditor does not automatically open a window, you will encounter two other windows: the menu editor and the background editor, shown, ! respectively, in Figures 3 and 4.</p> ! <p class="imageCaption"><img src="images/resEditorFig3.png" alt="background editor window" /><br /> ! Figure 3. Background Info Editor Window<br/> ! <img src="images/resEditorFig4.png" alt="menu editor window" /><br /> ! Figure 4. Menu Editor Window<br /></p> ! <p>There is also a String Editor which can be used to improve the ! flexibility and ease of internationalization of your application; ! this window is shown in Figure 5.</p> ! <p class="imageCaption"><img src="images/resEditorFig5.png" alt="string editor window" /><br /> ! Figure 5. String Editor Window<br /></p> <p>We will look at each of these windows in greater detail in subsequent sections of this document.</p> *************** *** 154,163 **** official release of PythonCard 1.0, you can choose one of four basic templates for creating a PythonCard application.</p> ! <p class="imageCaption"><img src="images/resEditorFig6.png" alt="dialog for using built-in templates" width="237" height="197" /><br /> Figure 6. Dialog for Selecting Built-In Templates as Starting Point for New Application</p> <p>The names of the templates describe the various options for creating a new ! application. Depending on your needs, you can select one of these or, for ! more completeness as a starting point, you can begin by copying an existing application and renaming files as outlined in walkthrough1 of the PythonCard documentation suite.</p> --- 157,166 ---- official release of PythonCard 1.0, you can choose one of four basic templates for creating a PythonCard application.</p> ! <p class="imageCaption"><img src="images/resEditorFig6.png" alt="dialog for using built-in templates" /><br /> Figure 6. Dialog for Selecting Built-In Templates as Starting Point for New Application</p> <p>The names of the templates describe the various options for creating a new ! application. You can select one of these, but it is oftne more productive to ! begin by copying an existing application and renaming files as outlined in walkthrough1 of the PythonCard documentation suite.</p> *************** *** 170,199 **** components supported in this release. All of these components are inherited from wxPython.</p> ! <p class="imageCaption"><img src="images/resEditorFig7.png" alt="component menu" width="404" height="409" /><br /> Figure 7. Component Menu in Resource Window</p> ! <p>When you select a component type, a new instance of that component gets ! placed in the window in the upper left corner. It is selected so that its ! properties are immediately available for editing in the Property Editor ! window and its size and position are reflected in the Size & Position ! window. Figure 8 shows a button placed in the window, while Figure 9 shows the Property Editor window's contents immediately after the initial placement ! of the button and Figure 10 shows the Size & Position window's contents ! at the same time.</p> ! <p class="imageCaption"><img src="images/resEditorFig8.png" alt="new button placed in resource window" width="402" height="294" /><br /> ! Figure 8. New Button Placed in Resource Editor Window<br /> ! <img src="images/resEditorFig9.png" alt="property editor window on new button" width="360" height="240" /><br /> ! Figure 9. Property Editor Window on Newly Placed Button<br /> ! <img src="images/resEditorFig10.png" alt="position & size editor on new button" width="196" height="68" /><br /> ! Figure 10. Position & Size Window on Newly Placed Button</p> ! <p>As you can see, the Property Editor Window shows, in its left-hand list, ! the name of the currently selected object ("Button1") and the name ! of its class ("Button"). The right-hand list lists all of the properties associated with the object. The bottom portion of the window ! changes depending on which property is being edited. Figure 11, for example, shows what the bottom area looks like if you select the button's "font" property. Notice the "Font..." button which, if clicked, will display the system's standard font dialog from which you can choose new settings.</p> ! <p class="imageCaption"><img src="images/resEditorFig11.png" alt="setting fonton newly placed button" width="360" height="240" /><br /> Figure 11. Property Editor Window Preparing to Edit Font of Selected Button</p> --- 173,213 ---- components supported in this release. All of these components are inherited from wxPython.</p> ! <p class="imageCaption"><img src="images/resEditorFig7.png" alt="component menu" /><br /> Figure 7. Component Menu in Resource Window</p> ! <p>When you select a component type, you are presented with a dialog to ! allow you to specify the name and, if appropriate, the label or text ! content for the new component. Figure 8 shows this name dialog; since it's ! a button component, it has a field for the Label as well as the one for ! the Name.</p> ! <p class="imageCaption"> ! <img src="images/resEditorFig8.png" alt="component name dialog" /><br /> ! Figure 8. Name and Label/Text dialog</p> ! <p>Once specified, the new instance of that component gets ! placed in the window in the upper left corner. Figure 9 shows a button ! placed in the top left of the Resource Editor Window</p> ! <p class="imageCaption"> ! <img src="images/resEditorFig9.png" alt="new button placed in resource window" /><br /> ! Figure 9. New Button Placed in Resource Editor Window</p> ! <p>It is selected so that its properties are immediately available for ! editing in the Property Editor window. Figure 10 shows the Property Editor window's contents immediately after the initial placement ! of the button, with the size and position shown in the window's status ! bar.</p> ! <p class="imageCaption"> ! <img src="images/resEditorFig10.png" alt="property editor window on new button" /><br /> ! Figure 10. Property Editor Window on Newly Placed Button</p> ! <p>The top left area of the Property Editor Window (Figure 10 above) ! shows the name ! of the currently selected object ("Button1") and the name ! of its class ("Button"). The top right area lists all of the properties associated with the object. The bottom portion of the window ! changes depending on which property is being edited. At the very bottom ! of the window, the status bar shows the component's position and size. ! Figure 11, for example, shows what the bottom area looks like if you select the button's "font" property. Notice the "Font..." button which, if clicked, will display the system's standard font dialog from which you can choose new settings.</p> ! <p class="imageCaption"><img src="images/resEditorFig11.png" alt="setting font on newly placed button" /><br /> Figure 11. Property Editor Window Preparing to Edit Font of Selected Button</p> *************** *** 203,207 **** in the Property Editor Window. Then you select the property you wish to change from the scrolling list of properties, make the appropriate adjustment ! to the setting, and click the "Update" button to instruct the resourceEditor to apply the new setting.</p> <p>Each component has a set of properties, some of which are shared with all --- 217,222 ---- in the Property Editor Window. Then you select the property you wish to change from the scrolling list of properties, make the appropriate adjustment ! to the setting, and either click the "Update" button or simply ! leave the edit field to instruct the resourceEditor to apply the new setting.</p> <p>Each component has a set of properties, some of which are shared with all *************** *** 209,213 **** component. These properties are delineated in the soon-to-be-published PythonCard Component Description document.</p> ! <p>The Size & Position Window displays those parameters for the selected window in your application or for the selected component in the window, but its contents are not editable. To change those properties, you must either --- 224,229 ---- component. These properties are delineated in the soon-to-be-published PythonCard Component Description document.</p> ! <p>The status bar of the Property Editor Window displays the size and ! position for the selected window in your application or for the selected component in the window, but its contents are not editable. To change those properties, you must either *************** *** 218,223 **** whole, and acts as the backdrop against which components are placed and which is the container of those components.</p> ! <p>As we saw in Figure 4, above, you can modify the properties of the ! application windows' backgrounds using the Background Information Editor, which is displayed by selecting "Background Info..." from the resourceEditor's "Edit" menu.</p> --- 234,239 ---- whole, and acts as the backdrop against which components are placed and which is the container of those components.</p> ! <p>As we saw in Figure 3, above, you can modify the properties of the ! application window's background using the Background Info Editor, which is displayed by selecting "Background Info..." from the resourceEditor's "Edit" menu.</p> *************** *** 230,241 **** opens, it will open at that location on the screen and at the indicated size. You'll find that if you resize the window and move it around on the ! screen, then reopen the Background Information Editor, it will update to reflect your changes.</p> - <p>(<strong>Note</strong> that in the current release of PythonCard, it is - not possible to make a fixed-size window that the user cannot resize. When - the user <em>does</em> resize a window, then exits the application, the - windows will restore themselves to their default sizes and positions on - restart unless you specifically write Python code to override those - settings.)</p> <p>You can alter the foreground and background colors of the window using standard color selector dialogs for your system. In this release, we --- 246,251 ---- opens, it will open at that location on the screen and at the indicated size. You'll find that if you resize the window and move it around on the ! screen, then reopen the Background Info Editor, it will update to reflect your changes.</p> <p>You can alter the foreground and background colors of the window using standard color selector dialogs for your system. In this release, we *************** *** 262,271 **** Menu Editor looks like when it has a complex set of menus defined. (It actually depicts the menus in the resourceEditor itself.)</p> ! <p class="imageCaption"><img src="images/resEditorFig12.png" alt="menu editor with full set of menus" width="480" height="300" /><br /> Figure 12. Menu Editor Showing Menus in resourceEditor's Resource File</p> <p>You can add a new menu by clicking on the New Menu button. The result looks like Figure 13. Notice that the new menu is called "New Menu" and appears at the bottom of the current list of menus in the application.</p> ! <p class="imageCaption"><img src="images/resEditorFig13.png" alt="menu editor with new menu defined" width="480" height="300" /><br /> Figure 13. Menu Editor Showing New Menu Being Defined</p> <p>By convention, you should name your menus starting with the word --- 272,281 ---- Menu Editor looks like when it has a complex set of menus defined. (It actually depicts the menus in the resourceEditor itself.)</p> ! <p class="imageCaption"><img src="images/resEditorFig12.png" alt="menu editor with full set of menus" /><br /> Figure 12. Menu Editor Showing Menus in resourceEditor's Resource File</p> <p>You can add a new menu by clicking on the New Menu button. The result looks like Figure 13. Notice that the new menu is called "New Menu" and appears at the bottom of the current list of menus in the application.</p> ! <p class="imageCaption"><img src="images/resEditorFig13.png" alt="menu editor with new menu defined" /><br /> Figure 13. Menu Editor Showing New Menu Being Defined</p> <p>By convention, you should name your menus starting with the word *************** *** 278,282 **** item at the bottom of the current list of menus and menu items, as shown in Figure 14.</p> ! <p class="imageCaption"><img src="images/resEditorFig14.png" alt="menu editor showing new menu item" width="480" height="300" /><br /> Figure 14. Menu Editor Showing New Menu Item Being Edited</p> <p>Again, naming conventions are useful. We recommend you name new menu items --- 288,292 ---- item at the bottom of the current list of menus and menu items, as shown in Figure 14.</p> ! <p class="imageCaption"><img src="images/resEditorFig14.png" alt="menu editor showing new menu item" /><br /> Figure 14. Menu Editor Showing New Menu Item Being Edited</p> <p>Again, naming conventions are useful. We recommend you name new menu items *************** *** 295,304 **** PythonCard places a text represetation of the key combination in the field.</p> ! <p class="imageOption"><img src="images/resEditorFig15.png" alt="menu editor showing menu item" width="480" height="300" /><br /> Figure 15. Menu Editor Showing Menu Item With Accelerator Key and Shortcut Defined</p> <p>You can also connect the menu to a command object defined in your Python script (see "Connecting Components and Menus to Scripts," below). ! In addition, you can determine whether the menu item is enabled when the application launches, whether it is checkable and whether its default condition is to be checked if it is checkable. PythonCard handles the --- 305,318 ---- PythonCard places a text represetation of the key combination in the field.</p> ! <p class="imageCaption"><img src="images/resEditorFig15.png" alt="menu editor showing menu item" /><br /> Figure 15. Menu Editor Showing Menu Item With Accelerator Key and Shortcut Defined</p> <p>You can also connect the menu to a command object defined in your Python script (see "Connecting Components and Menus to Scripts," below). ! Since many UIs have alternate ways to do the same operations available ! from the menu (e.g. command buttons, toolbars, etc.), a convenient way to ! do this is to use the command object, and connect to it from both the menu ! and the alternate button.</p> ! <p>In addition, you can determine whether the menu item is enabled when the application launches, whether it is checkable and whether its default condition is to be checked if it is checkable. PythonCard handles the *************** *** 320,324 **** Dialog" option from the File menu. The resulting editor looks like Figure 16.</p> ! <p class="imageCaption"><img src="images/resEditorFig16.png" alt="new dialog dialog" width="315" height="123" /><br /> Figure 16. Editing Window for New Dialog</p> <p>Notice that a new dialog template includes two buttons by default, one --- 334,338 ---- Dialog" option from the File menu. The resulting editor looks like Figure 16.</p> ! <p class="imageCaption"><img src="images/resEditorFig16.png" alt="new dialog dialog" /><br /> Figure 16. Editing Window for New Dialog</p> <p>Notice that a new dialog template includes two buttons by default, one *************** *** 333,337 **** dialogs).</li> </ul> ! <p class="imageCaption"><img src="images/resEditorFig17.png" alt="dialog info editor" width="370" height="170" /><br /> Figure 17. Dialog Information Editor Window</p> <p>A discussion of how to incorporate dialogs into your PythonCard --- 347,351 ---- dialogs).</li> </ul> ! <p class="imageCaption"><img src="images/resEditorFig17.png" alt="dialog info editor" /><br /> Figure 17. Dialog Information Editor Window</p> <p>A discussion of how to incorporate dialogs into your PythonCard *************** *** 342,351 **** <p>There are two ways to create a connection between an active component or menu item in your PythonCard application and the application's behavior as ! defined in your Python script file: events and commands. Since this document ! describes the resourceEditor and since scripting is conducted outside the ! resourceEditor, we will here consider only summarily the <em>process</em> by ! which these connections are made. For details and examples, see the tutorial ! walk-throughs, particularly <a href="walkthrough3.html">walkthrough3</a> ! and <a href="walkthrough4.html">walkthrough4</a></p> <h3>Events</h3> <p>When the user activates a component in your PythonCard application, that --- 356,367 ---- <p>There are two ways to create a connection between an active component or menu item in your PythonCard application and the application's behavior as ! defined in your Python script file: events and commands. (Remember that ! not all components need to have actions associated with them). ! The resourceEditor creates and manages the visual components of your ! application. Actions for these components are created in the associated ! Python script ... ! For details and examples, see the tutorial ! walk-throughs, particularly <a href="walkthrough2.html">walkthrough2</a> ! and <a href="walkthrough3.html">walkthrough3</a></p> <h3>Events</h3> <p>When the user activates a component in your PythonCard application, that *************** *** 389,393 **** command is the middle portion of the handler name, which in Figure 17 results in the object being told it is to execute the command editClear.</p> ! <p class="imageCaption"><img src="images/resEditorFig18.png" alt="connecting a button to a command" width="360" height="240" /><br /> Figure 18. Connecting a Button to the editClear Command</p> <h2>Additional Features</h2> --- 405,409 ---- command is the middle portion of the handler name, which in Figure 17 results in the object being told it is to execute the command editClear.</p> ! <p class="imageCaption"><img src="images/resEditorFig18.png" alt="connecting a button to a command" /><br /> Figure 18. Connecting a Button to the editClear Command</p> <h2>Additional Features</h2> *************** *** 408,412 **** with the running application. From the File menu, choose "Run options..." The dialog box shown in Figure 19 appears.</p> ! <p class="imageCaption"><img src="images/resEditorFig19.png" alt="run options dialog" width="200" height="220" /><br /> Figure 19. Run Options Dialog</p> <p>You can check any or all of the options in this dialog to affect the way --- 424,428 ---- with the running application. From the File menu, choose "Run options..." The dialog box shown in Figure 19 appears.</p> ! <p class="imageCaption"><img src="images/resEditorFig19.png" alt="run options dialog" /><br /> Figure 19. Run Options Dialog</p> <p>You can check any or all of the options in this dialog to affect the way *************** *** 429,437 **** pythoncard.log. An explanation of the log is beyond the scope of this document.</p> ! <p class="imageCaption"><img src="images/resEditorFig20.png" alt="sample debugging log file" width="656" height="250" /><br /> Figure 20. Sample Debugging Log File</p> <p>The Message Watcher runtime option opens a window (see Figure 21) that monitors messages as they are triggered inside your application.</p> ! <p class="imageCaption"><img src="images/resEditorFig21.png" alt="" width="200" height="300" /><br /> Figure 21. Message Watcher Window Showing Sample Message Information</p> <p>The checkboxes at the top of the window allow you to restrict the messages --- 445,453 ---- pythoncard.log. An explanation of the log is beyond the scope of this document.</p> ! <p class="imageCaption"><img src="images/resEditorFig20.png" alt="sample debugging log file" /><br /> Figure 20. Sample Debugging Log File</p> <p>The Message Watcher runtime option opens a window (see Figure 21) that monitors messages as they are triggered inside your application.</p> ! <p class="imageCaption"><img src="images/resEditorFig21.png" alt="message watcher window" /><br /> Figure 21. Message Watcher Window Showing Sample Message Information</p> <p>The checkboxes at the top of the window allow you to restrict the messages *************** *** 449,453 **** which is a tree outline and therefore can expand and collapse as desired -- displays appropriate information about them in the right text pane.</p> ! <p class="imageCaption"><img src="images/resEditorFig22.png" alt="namespace viewer" width="748" height="454" /><br /> Figure 22. Namespace Viewer Window With Representative Content</p> <p>If you check the "Property Editor" checkbox in the Run Options --- 465,469 ---- which is a tree outline and therefore can expand and collapse as desired -- displays appropriate information about them in the right text pane.</p> ! <p class="imageCaption"><img src="images/resEditorFig22.png" alt="namespace viewer" /><br /> Figure 22. Namespace Viewer Window With Representative Content</p> <p>If you check the "Property Editor" checkbox in the Run Options *************** *** 469,473 **** difficult-to-locate error. You can also use the Shell to send messages to your application manually.</p> ! <p class="imageCaption"><img src="images/resEditorFig23.png" alt="shell window open in application" width="500" height="200" /><br /> Figure 23. Shell Window Showing Interaction With Running Application</p> <h4>Debugging a Running PythonCard Application</h4> --- 485,489 ---- difficult-to-locate error. You can also use the Shell to send messages to your application manually.</p> ! <p class="imageCaption"><img src="images/resEditorFig23.png" alt="shell window open in application" /><br /> Figure 23. Shell Window Showing Interaction With Running Application</p> <h4>Debugging a Running PythonCard Application</h4> *************** *** 480,484 **** through them so you'll be sure you know how to use this powerful feature of PythonCard's resourceEditor.</p> ! <p class="imageCaption"><img src="images/resEditorFig24.png" alt="Debug menu in running application" width="242" height="227" /><br /> Figure 24. Debug Menu in Running PythonCard Application</p> <p>The first four items are toggles. If you wish to open the Message Watcher --- 496,500 ---- through them so you'll be sure you know how to use this powerful feature of PythonCard's resourceEditor.</p> ! <p class="imageCaption"><img src="images/resEditorFig24.png" alt="debug menu in running application" /><br /> Figure 24. Debug Menu in Running PythonCard Application</p> <p>The first four items are toggles. If you wish to open the Message Watcher *************** *** 543,547 **** application. Selecting that menu option produces a window something like the one shown in Figure 25.</p> ! <p class="imageCaption"><img src="images/resEditorFig25.png" alt="viewing the resource file" width="500" height="300" /><br /> Figure 25. Resource Viewer</p> <p>Examining the resource file, which as you can see stores a single Python --- 559,563 ---- application. Selecting that menu option produces a window something like the one shown in Figure 25.</p> ! <p class="imageCaption"><img src="images/resEditorFig25.png" alt="viewing the resource file" /><br /> Figure 25. Resource Viewer</p> <p>Examining the resource file, which as you can see stores a single Python *************** *** 561,569 **** background has its set of properties. Dealing with multiple-window applications in the resourceEditor has also not been addressed here. You'll ! find that in soon-to-be-published walkthrough4 of our tutorial series when it ! is available.</p> ! <p>The resourceEditor's UI is built in resourceEditor. You can examine it and, of course, in the grand tradition of Open Source, you are free to modify ! it, add to its functionality, change labels on things, etc.</p> <?php include "footer.php" ?> <p>$Revision$ : $Author$ : Last updated $Date$</p> --- 577,591 ---- background has its set of properties. Dealing with multiple-window applications in the resourceEditor has also not been addressed here. You'll ! find that in <a href="walkthrough3.html">walkthrough3</a> of our ! tutorial series.</p> ! <p>That concludes our tour of Pythoncard's resourceEditor. We hope it gets ! you on the way to being productive quickly.</p> ! <p>The resourceEditor's UI is built in resourceEditor. You are free to examine it and, of course, in the grand tradition of Open Source, you are free to modify ! it, add to its functionality. If you do this please feed changes back into ! the Pythoncard community and consider joining the development list: ! pyt...@li.... User questions are dealt with ! helpfully and promptly on the user list: ! pyt...@li....}</p> <?php include "footer.php" ?> <p>$Revision$ : $Author$ : Last updated $Date$</p> |