I want to make a program that draws a diagram of Lennard-Jones potential with parameters epsilon and sigma being adjustable with two sliders. I want my program to work like this
- Small window with two sliders appear
- I adjust both sliders
- I click "show"
- A diagram of potential appears
This is my code:
from Tkinter import *
import pylab as p
def show_values():
V=4*epsilon.get()*(math.pow((sigma.get()/r),12)-math.pow((sigma.get()/r,6)))
p.plot(t,V)
p.show()
r = p.arange(0.1, 5.0, 0.01)
master = Tk()
epsilon = Scale(master, from_=0, to=42)
epsilon.pack()
sigma = Scale(master, from_=0, to=200, orient=HORIZONTAL)
sigma.pack()
Button(master, text='Show', command=show_values).pack()
master.mainloop()
When I click "run the current file" nothing happens. No error messages. Whad I did wrong? I work in canopy 32-bit, windows 7.