WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-16-2005, 03:51 PM
Jerry Jerry is offline
Member
 
Join Date: Jun 2004
Posts: 105
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()
Reply With Quote
  #2  
Old 11-16-2005, 04:15 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:28 PM.


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