![]() |
|
|
|
#1
|
|||
|
|||
|
You can use the vizact library to enable a timer while the button is down. Here is a simple script showing how to do this:
Code:
import viz
import vizact
viz.go()
# Create model
model = viz.add('logo.ive',pos=(0,1,5))
# Create function to rotate model
def RotateModel():
model.setEuler(90*viz.elapsed(),0,0,viz.REL_LOCAL)
# Create disabled timer to call RotateModel function
rotateTimer = vizact.ontimer(0,RotateModel)
rotateTimer.setEnabled(False)
# Create button
rotateButton = viz.addButton(pos=(0.9,0.1,0))
# Enable rotate timer while button is pressed
vizact.onbuttondown(rotateButton,rotateTimer.setEnabled,True)
vizact.onbuttonup(rotateButton,rotateTimer.setEnabled,False)
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create Button or Text | Chrissy2009 | Vizard | 1 | 07-15-2009 06:34 PM |
| Trouble loading a .obj file into a scene through a button | djones1010 | Vizard | 1 | 04-27-2009 12:51 PM |
| button events when drawing over gui elements | moooh | Vizard | 2 | 04-10-2009 02:01 AM |
| button problems | cade_mccall | Vizard | 3 | 02-22-2007 10:48 AM |
| on/off button | bailenson | Vizard | 1 | 09-28-2004 06:13 PM |