This section of the manual walks you through every element of the NetLogo interface in order and explains its function.
In NetLogo, you have the choice of or viewing models found in the Models Library, adding to existing models, or creating your own models. The NetLogo interface was designed to meet all these needs.
The interface can be divided into two main parts: NetLogo menus, and the main NetLogo window. The main window is divided into tabs.
On Macs, if you are running the NetLogo application, the menubar is located at the top of the screen. On other platforms, the menubar is found at the top of the NetLogo window.
The functions available from the menus in the menubar are listed in the following chart.
File |
||
|
New |
Starts a new model. |
|
Open |
Opens any NetLogo model on your computer. |
|
Models Library |
A collection of demonstration models. |
|
Save |
Save the current model. |
|
Save As |
Save the current model using a different name. |
|
Save As Applet |
Used to save a web page in HTML format that has your model embedded in it as a Java "applet". |
|
|
Sends the contents of the currently showing tab to your printer. |
|
Export World |
Saves all variables and the current state of all turtles and patches to a file. |
|
Export Plot |
Saves the data in a plot to a file. |
|
Export All Plots |
Saves the data in all the plots to a file. |
|
Export Graphics |
Save a picture of the graphics window to a file (in PNG format). |
|
Export Output |
Save the contents of the output section of the command center to a file. |
|
Import World |
Load a file that was saved by Export World. |
|
Quit |
Exits NetLogo. (On Macs, this item is on the NetLogo menu instead.) |
Edit |
||
|
Cut |
Cuts out or removes the selected text and temporarily saves it to the clipboard. |
|
Copy |
Copies the selected text. |
|
Paste |
Places the clipboard text where cursor is currently located. |
|
Delete |
Deletes selected text. |
|
Undo |
Undo last text editing action you performed. |
|
Find |
Finds a word or sequence of characters within the Information, Procedures, or Errors tab. |
|
Find Again |
Find the next occurrence of the word or sequence you last used Find with. |
|
Shift Left / |
Used in the Procedures and Errors tabs to change the indentation level of code. |
|
Comment / |
Used in the Procedures and Errors tabs to add or remove semicolons from code (semicolons are used in NetLogo code to indicate comments). |
Tools |
||
|
Halt |
Stops all running code, including buttons and the command center. (Warning: since the code is interrupted in the middle of whatever it was doing, you may get unexpected results if you try to continue running the model without first pressing "setup" to start the model run over.) |
|
Globals Monitor |
Displays the values of all global variables. |
|
Turtle Monitor |
Displays the values of all of the variables in a particular turtle. You can can also edit the values of the turtle's variables and issue commands to the turtle. (You can also open a turtle monitor via the Graphics Window; see the Graphics Window section below.) |
|
Patch Monitor |
Displays the values of all of the variables in a particular patch. You can can also edit the values of the patch's variables and issue commands to the patch. (You can also open a patch monitor via the Graphics Window; see the Graphics Window section below.) |
|
Shapes Editor |
Draw turtle shapes. See the Shapes Editor Guide for more information. |
|
BehaviorSpace |
Runs the model over and over with different settings. See the BehaviorSpace Guide for more information. |
|
HubNet Control Center |
Disabled if no HubNet activity is open. See the HubNet Guide for more information. |
Zoom |
||
|
Larger |
Increase the overall screen size of the model. Useful on large monitors or when using a projector in front of a group. |
|
Normal Size |
Reset the screen size of the model to the normal size. |
|
Smaller |
Decrease the overall screen size of the model. |
Tabs |
This menu offers keyboard shortcuts for each of the tabs. (On Macs, it's Command 1 through Command 4. On Window, it's Control 1 through Control 4.) |
|
Help |
||
|
About NetLogo |
Information on the current NetLogo version the user is running. (On Macs, this menu item is on the NetLogo menu instead.) |
|
User Manual |
Opens this manual in a web browser. |
At the top of NetLogo's main window are four tabs labeled "Interface", "Information", "Procedures", and "Errors". Only one tab at a time can be visible, but you can switch between them by clicking on the tabs at the top of the window.
Right below the row of tabs is a toolbar containing a row of buttons. The buttons available vary from tab to tab.
The Interface tab is where you watch your model run. It also has tools you can use to inspect and alter what's going on inside the model.
When you first open NetLogo, the Interface tab is empty except for the Graphics Window, where the turtles and patches appear, and the Command Center, which allows you to issue NetLogo commands.
The toolbar contains buttons that let you edit, delete, and create items in the Interface tab (such as buttons and sliders).
The buttons in the toolbar are described below.
Selecting: To select an interface element, drag a rectangle around it with your mouse. A gray border will appear around the element to indicate that it is selected.
Selecting Multiple Items: You can select multiple interface elements at the same time by including them in the rectangle you drag. If multiple elements are selected, one of them is the "key" item, which means that if you use the "Edit" or "Delete" buttons on the Interface Toolbar, only the key item is affected. The key item is indicated by a darker gray border than the other items.
Unselecting: To unselect all interface elements, click the mouse on the white background of the Interface tab. To unselect an individual element, control-click (Macintosh) or right-click (other systems) the element and choose "Unselect" from the popup menu.
Editing: To change the characteristics of an interface element, select the element, then press the "Edit" button on the Interface Toolbar. You may also double click the element once it is selected. A third way to edit an element is to control-click (Macintosh) or right-click (other systems) it and choose "Edit" from the popup menu. If you use this last method, it is not necessary to select the element first.
Moving: Select the interface element, then drag it with your mouse to its new location. If you hold down the shift key while dragging, the element will move only straight up and down or straight left and right.
Resizing: Select the interface element, then drag the black "handles" in the selection border.
Deleting: Select the element or elements you want to delete, then press the "Delete" button on the Interface Toolbar. You may also delete an element by control-clicking (Macintosh) or right-clicking (other systems) it and choosing "Delete" from the popup menu. If you use this latter method, it is not necessary to select the element first.
To learn more about the different kinds of interface elements, refer to the chart below.
Icon & Name | Description |
---|---|
Buttons can be either once-only buttons or forever buttons. When you click on a once-button, it executes its instructions once. The forever-button executes the instructions over and over, until you click on the button again to stop the action. | |
Sliders are global variables, which are accessible by all agents. They are used in models as a quick way to change a variable without having to recode the procedure every time. Instead, the user moves the slider to a value and observe what happens in the model. | |
Switches are a visual representation for a true/false variable. The user is asked to set the variable to either on (true) or off (false) by flipping the switch. | |
Choices let the user pick a value for a global variable from a list of choices, presented in a drop down menu. | |
Monitors display the value of any expression. The expression could be a variable, a complex expression, or a call to a reporter. Monitors automatically update several times per second. | |
Plots are real-time graphs of data the model is generating. | |
A Text Box lets you create text labels in the Interface tab. |
The Graphics Window initially appears as a large black square on the Interface tab. This is the graphical world of NetLogo's turtles and patches.
Some NetLogo models let you interact with the turtles and patches with your mouse by clicking and dragging in the Graphics Window.
The Graphics Window provides an easy way to open a turtle monitor or patch monitor. Just control-click (Macintosh) or right-click (other systems) on the turtle or patch you want to inspect, and choose "inspect turtle ..." or "inspect patch ..." from the popup menu. (Turtle and patch monitors can also be opened from the Tools menu or by using the inspect command.)
There are a number of settings associated with the Graphics Window. There are two ways of changing the settings: by using the control strip along the top edge of the Graphics Window, or by editing the Graphics Window, as described in the "Working With Interface Elements" section above. (Or, pressing the "More..." button in the control strip is an alternate and quicker way.)
The controls in the control strip work as follows:
Here are the settings for the Graphics Window (accessible by editing the Graphics Window, or by pressing the "More..." button in the control strip):
To change the size of the Graphics Window adjust the "Patch Size" setting, which is measured in pixels. This does not change the number of patches, only how large the patches appear on the screen. To change the number of patches, alter the "Screen Edge X" and "Screen Edge Y" settings. (Note that changing the numbers of patches requires rebuilding the NetLogo world; you will lose all turtles and the values of all variables.)
The "Turtle Shapes" checkbox performs the same function as the shapes button in the control strip, discussed above.
In most NetLogo models, turtles are visible at their exact locations, and may vary in size. If you turn off the "Exact Turtle Positions" checkbox, then:
The Command Center allows you to issue commands directly, without adding them to the model's procedures. (Commands are instructions you give to turtles, patches, and the observer.) This is useful for inspecting and manipulating agents on the fly.
(Tutorial #2: Commands is an introduction to using commands in the Command Center.)
Let's take a closer look at the design of the Command Center.
You will notice there is a large display box, an agent popup menu (O>), a "clear" button, and the history popup menu (with the little black triangle). The top large display box temporarily stores all of the commands that are entered into the Command Center. This area is strictly for reference; commands cannot be accessed or changed from this box. To clear this box, click "clear" in the top right corner.
The smaller text box, below the large box, is where commands are entered. On the left of this box is the agent popup menu, and on the right is the history popup menu.
The agent popup menu allows you to select either observer, turtles, or patches. This is an easy way to assign an agent to a command and it is the same as writing ask turtles [ ... ]. Note: a quicker way to change between observer, turtles, and patches is to use the tab key on your keyboard.
The history popup menu lists all of the commands entered that can be accessed and used again. The up and down arrow keys on your keyboard will retrieve that last command that was written.
Note that pressing the "clear" function clears only the large display box and not the history. To clear the history section, choose "clear history", found at the top of its popup menu.
This tab is the workspace where the code for the model is stored. Commands you only want to use immediately go in the Command Center; commands you want to save and use later, over and over again, are found in the Procedures tab.
To determine if the code has any errors, press the "Compile" button. If there are any syntax errors, the Errors tab will come to the front of the screen and turn red. The code that contains the error will be highlighted and a comment will appear in the top box. Switching tabs also causes the code to be compiled and any errors will be shown, so if you switch tabs, pressing the Compile button first isn't necessary.
To find a fragment of code in the procedures, click on the magnifying glass on the Procedures Toolbar. Then enter the text you are looking for, and hit the "Find" button. The "Find Again" button finds the next location of the word or fragment of code throughout the procedure.
To find a particular procedure definition in your code, use the "Procedures" popup menu in the Procedures Toolbar. The menu lists all procedures in alphabetical order.
The "Shift Left", "Shift Right", "Comment", and "Uncomment" items on the Edit menu are used in the procedures tab to change the indentation level of your code or add and remove semicolons, which mark comments, from sections of code.
For more information about writing procedures, read Tutorial #3: Procedures and the Programming Guide.
The Information tab provides an introduction to the model and an explanation of how to use it, things to explore, possible extensions, and NetLogo features. It is very helpful when you're first exploring a model.
We recommend reading the Information tab before starting the model. The Information tab explains what principle is being modeled and how the model was created.
The Errors tab provides a place for errors to be highlighted and brought to your attention. If there are any errors in your code, the "Errors" tab will turn red and come to the front with an explanation of what caused the error. When there are no errors, the Tab is disabled.
Switching tabs, or pressing the "Compile" button in the toolbar, causes your code to be checked for errors.