You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to VPython-users
Hey guys how do you pause a program on mouse click? I have an animation running and I want to have it pause when the mouse is clicked. Any help would be awesome!
-Matthew
Bruce Sherwood
unread,
Nov 14, 2017, 11:20:54 AM11/14/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to VPython-users
Here is one way:
b = box(pos=vec(-10,0,0))
run = True
def handle(c):
global run
run = c.checked
checkbox(bind=handle, text='Run', checked=True)
while True:
rate(10)
if run:
b.pos.x += 0.1
Bruce Sherwood
unread,
Nov 14, 2017, 11:23:31 AM11/14/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to VPython-users
And here's a different way:
b = box(pos=vec(-10,0,0))
scene.caption = 'Click to toggle between run and pause'