donnieh
Jul 15, 2015 - 18:17
I have a string from a textfield that I want to input as the math function. How do I take this string and allow the plot function to recognize it as a math expression?
t = arange(0.0, 2.0, 0.01)
s = self.tf.text #text coming in from textfield is: 'sin(2*pi*t)'
plt.plot(t, s)
Just to verify, the program works by setting s = to the function:
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plt.plot(t, s)