'''on execution of button.py a button appears ,after clicking on the button it calls bounce.py but after closing bounce.py the button also closes...but i want the button to remain open...please help. im posting both the programs button.py and bounce.py NOTE: im using vpython in bounce.py and windows os'''
button.py
-------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
bounce.py
-----------------------------------------------------------------------------------------------------------------
button.py
-------------------------------------------------------------------------------------------------------------------
Code:
from Tkinter import *
import fileinput
root = Tk()
root.title("Note Taker")
def Button1():
execfile('bounce.py',{})
button1 = Button(root, text="bounce", command = Button1)
text = Entry(root)
button1.pack()
root.mainloop()
bounce.py
-----------------------------------------------------------------------------------------------------------------
Code:
from visual import *
floor = box(length=4, height=0.5, width=4, color=color.blue)
ball = sphere(pos=(0,4,0), color=color.red)
ball.velocity = vector(0,-1,0)
dt = 0.01
while 1:
rate(100)
ball.pos = ball.pos + ball.velocity*dt
if ball.y < 1:
ball.velocity.y = -ball.velocity.y
else:
ball.velocity.y = ball.velocity.y - 9.8*dt
Comment