WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 07-20-2009, 01:20 AM
snoopy78 snoopy78 is offline
Join Date: Jul 2009
Posts: 4
Push a button


I want to push a button with my mouse and afterthat my object should rotate for a special amount.

This works, but I had to push the button again and again.

def onButton(obj,state):
  if obj == scene3.btnLeftRotate1:
    if state == viz.DOWN:


I want to push the button one-time with my mouse and as long as I hold the button pressed, the object should move on and on.
Reply With Quote
Old 07-20-2009, 09:39 AM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849
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:
import viz
import vizact

# Create model
model = viz.add('logo.ive',pos=(0,1,5))

# Create function to rotate model
def RotateModel():
# Create disabled timer to call RotateModel function
rotateTimer = vizact.ontimer(0,RotateModel)

# Create button
rotateButton = viz.addButton(pos=(0.9,0.1,0))

# Enable rotate timer while button is pressed
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
Create Button or Text Chrissy2009 Vizard 1 07-15-2009 05:34 PM
Trouble loading a .obj file into a scene through a button djones1010 Vizard 1 04-27-2009 11:51 AM
button events when drawing over gui elements moooh Vizard 2 04-10-2009 01:01 AM
button problems cade_mccall Vizard 3 02-22-2007 09:48 AM
on/off button bailenson Vizard 1 09-28-2004 05:13 PM

All times are GMT -7. The time now is 02:41 AM.

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