WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-03-2010, 09:28 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You can modify a variable within a function by using the global keyword. Here pressing the spacebar modifies a variable and then prints it.
Code:
import viz
import vizact

viz.go()

var = 1

def addTwo():
	global var
	var += 2
	print var
	
vizact.onkeydown(' ',addTwo)
Reply With Quote
 

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Textures for Diffuse and Specularity Shader Issue shivanangel Vizard 1 05-11-2009 10:44 AM


All times are GMT -7. The time now is 12:58 PM.


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