You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h1>print<aclass="headerlink" href="#print" title="Permalink to this heading">¶</a></h1>
<p>To output text to a scrolling text area (a field beneath the canvas in WebVPython; the console if using the vpython package in Python), you can use the standard Python <strong>print()</strong> function. Standard Python formatting options are available.</p>
<p>For <strong>WebVPython only</strong>, you can control the width and height of the print region:</p>
<dlclass="py function">
<dtclass="sig sig-object py" id="print_options">
<spanclass="sig-name descname"><spanclass="pre">print_options</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">width</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">500</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">height</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">300</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">readonly</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">False</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">digits</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">4</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">pos</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">'right'</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">place</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">scene.title_anchor</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#print_options" title="Permalink to this definition">¶</a></dt>
<li><p><strong>width</strong> (<em>scalar</em>) – Width of print region.</p></li>
<li><p><strong>height</strong> (<em>scalar</em>) – Height of print region.</p></li>
<li><p><strong>readonly</strong> (<em>boolean</em>) – If <em>True</em>, user cannot edit text in print region. Default <em>True</em> (but user can still copy output text).</p></li>
<li><p><strong>digits</strong> (<em>scalar</em>) – If <em>digits=4</em> then 123.456 will display as 123.4. Default is 6.</p></li>
<li><p><strong>pos</strong> (<em>string</em>) – Position of print area with respect to the canvas. Default is “bottom” (under the canvas). If you set <em>pos=”right”</em> print are will appear to the right of the canvas, assuming the window is wide enough.</p></li>
<li><p><strong>place</strong> (<em>anchor location</em>) – If <em>place=scene.title.anchor</em> print area will be in the title region. <em>scene.caption.anchor</em> is also possible.</p></li>