WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   user input problem (https://forum.worldviz.com/showthread.php?t=456)

Jerry 11-16-2005 02:51 PM

user input problem
 
In the following script I want to have the user enter the name of a text file which is later read from within a called function. It works, but a yellow error marker appears at the line that calls the function and the cursor jumps to that line. This is annoying since I then have to find the place in the script where I was editing. Can you suggest a better way to do this?

import viz

viz.go()

filename = input('filename?')

def openfile():
global filename

file = open(filename, 'r')

openfile()

farshizzo 11-16-2005 03:15 PM

Hi,

Try the following instead:
Code:

if viz.running():
        openfile()

This makes sure that the file is not opened when the script is being parsed within the GUI.


All times are GMT -7. The time now is 02:57 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC