


Color vector code that have decimal value how to#
The Example program ScrollingText shows how to create a scrolling text object that you can send output to and type into, using the HTML element "textarea". The wtext object lets you place dynamically modifiable text in the middle of the caption or title of a canvas. The canvas documentation explains how to add text above a canvas (scene.title) or below a canvas (scene.caption). Print_options(width=150, readonly=False) Additional text output methods

You can of course combine any options in one statement: If you don't request the contents, print_options returns the empty character string ""'. The text is extracted before processing clear or destroy requests. You can obtain the current contents of the print region as a character string: Print_options(place=scene.caption_anchor) You can also place the print area at a specifiable place on the page: You can delete the region from the screen with this statement:Īfter deleting the region, another print statement will recreate it, with the previously specified width and height.īy default the print area appears underneath the canvas (pos = 'bottom') but you can make it appear to the right of the canvas with the following statement (you may have to include something like width=100, because if the window is too narrow to fit the canvas and the text area side by side, the text area goes below the canvas): You can clear out all the text from the region like this: You can specify the number of digits to display: In any case, the user can select text and copy the text with ctrl-c.īy default, numbers are displayed with six digits, such as 123.456 or 1.23456e+8. If you want the user to be able to edit the text, do this: If you execute this after executing print statements, the size of the region will change (but will retain its contents).īy default, the text in the print region is read-only the user cannot edit the text. If you execute this before your first print statement, the initial size will be 500 by 300. The following statement changes both the width (default 640) and height (default 100) of the print region. With print_options you can change the default size of the print region, allow the user to edit the text, clear the text from the region, destroy the region, or obtain the current contents of the print region. S = "Here are fixed format () versions.".format(127.73) Print options (not currently available in VPython 7) The elements "sep=., end=." must be the last arguments in the print statement. You can change the end of line ('\n" by default) and the item separator (" " by default). You can print multiline text like the following: Later print statements add to the existing text, with end-of-line breaks after each print, and with spaces between items listed in a print statement. The first print statement creates the scrolling text region. The print function places text in a scrolling text region at the bottom of the window.
