[Matplotlib-users] Query about Programming Error

Roberto Martin ZAMORA NEVADO roberto.zamora1 at unmsm.edu.pe
Tue Dec 20 14:14:26 EST 2022


I am developing a program for research purposes to enter from Tkinter
values of mean, standard deviation and ranges, to graph a normal
distribution, but it throws me an error of
Traceback (most recent call last):
  File "C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py",
line 1921, in __call__
    return self.func(*args)
  File "g:\Cursos\Curso Básico de Python\Prueba 102", line 45, in
Graph_Generator
    x=np.linspace[normal(a.get()), normal(b.get()),(c.get())]
TypeError: 'rv_continuous_frozen' object is not callable

El código que he desarrollado en visual studio es:
from tkinter import*
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats


root=Tk()

mu=DoubleVar()
sigma=DoubleVar()
a=DoubleVar()
b=DoubleVar()
c=DoubleVar()

label10=Label(root,text="Media",font=("Times_New_Roman",20))
label10.place(x=180,y=100)
entry6=Entry(root,textvariable=mu,font=("Times_New_Roman",20))
entry6.place(x=600, y=100)

label11=Label(root,text="Desviación estándar",font=("Times_New_Roman",20))
label11.place(x=180,y=200)
entry7=Entry(root,textvariable=sigma,font=("Times_New_Roman",20))
entry7.place(x=600, y=200)

label12=Label(root,text="Linspace1",font=("Times_New_Roman",20))
label12.place(x=180,y=300)
entry8=Entry(root,textvariable=a,font=("Times_New_Roman",20))
entry8.place(x=600, y=300)

label13=Label(root,text="Linspace2",font=("Times_New_Roman",20))
label13.place(x=180,y=400)
entry9=Entry(root,textvariable=b,font=("Times_New_Roman",20))
entry9.place(x=600, y=400)

label14=Label(root,text="Linspace3",font=("Times_New_Roman",20))
label14.place(x=180,y=500)
entry10=Entry(root,textvariable=c,font=("Times_New_Roman",20))
entry10.place(x=600, y=500)



def Graph_Generator ():

    normal= stats.norm(mu,sigma)
    x=np.linspace[normal(a.get()), normal(b.get()),(c.get())]
    fp= normal.pdf(x) #función de probabilidad
    plt.plot(x,fp)
    plt.show()

graph_button=Button(root, text="Generate graph", command=Graph_Generator)
graph_button.pack(pady=30)
root.mainloop()



How can I find a solution to this problem?



*Ing. Roberto Martín Zamora Nevado*
*CIP 74861*
*Cel. 945990731*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/matplotlib-users/attachments/20221220/28bf6a35/attachment.html>


More information about the Matplotlib-users mailing list