#1
|
|||
|
|||
Interactive Window
Hi,
I was hoping I could get something cleared up for me. I like to use the interactive window for keeping track of certain variables during testing for my various callback functions, like if a certain key is pressed for example. However, I'm curious as to how the interactive window works while the simulation is being loaded. For example, my program reads a bunch of data from an input file in order to setup walls, objects, etc. Data holds the input file data, and the for loop goes through it one line at a time for x in data: x = x[:-1] # remove trailing \n if (property == 'length'): # set length of floor area ... etc etc... if (property == width'): # set length of floor area ... etc etc... if (x == '# ROOM DIMENSION LENGTH'): property = 'length' elif (x == '# ROOM DIMENSION WIDTH'): property = 'width' It works like something similar to that. It searches through the input file, detects flags that lets the code what property the upcoming numbers are related to, and then assigns those numbers to the proper variables. Anyways, that's the backgroud. My question is while this list is being read, all my PRINT statements seem to get pumped out to the interactive menu right away with bad values, but if I use viz.message() instead, it gives me what i want as data gets loaded, just in various popup windows. Why do all the print statements get thrown out to the user at once, without waiting like viz.message() does? |
#2
|
|||
|
|||
Hi,
When you run a script within Vizard, it is actually executed twice. It is first executed to check for errors. If there are no errors then the script is passed on to the graphics engine. During this first execution you can prevent certain code from being executed by doing the following: Code:
if viz.running(): #This code won't be called during first execution |
|
|