Найти - Пользователи
Полная версия: int() argument must be a string or a number, not 'instancemethod'
Начало » Центр помощи » int() argument must be a string or a number, not 'instancemethod'
1
Tidusss
Такая вот программка с графическим интерфейсом, выдает ошибку, что аргумент инт должен быть только числом, хотя я точно ввожу именно число. Что неправильно?
from Tkinter import *
import tkFileDialog

def put(event):
a = ent1.get
b = ent2.get
n = ent3.get
a = int(a)
b = int(b)
n = int©
def fi(x):
return sin(x)
db-a)/n
x=a-d
z=0
for i in range(n):
x = x+d
z = z+(fi(x)*d+0.5*d*(fi(x+d)-fi(x)))
print z

root=Tk()
root.title('integration')
root.geometry('500x200')
Label( root, text='a=' ).place(x=30,y=50)
Label( root, text='b=' ).place(x=30,y=80)
Label( root, text='n=' ).place(x=30,y=110)

ent1 = Entry( root, width=10)
ent1.place(x = 50, y = 50)
ent2 = Entry( root, width=10)
ent2.place(x = 50, y = 80)
ent3 = Entry( root, width=10)
ent3.place(x = 50, y = 110)

button1 = Button(root,text='decide',width=8,height=2,bg='gold',fg='black').place(x = 230, y = 140)
button2 = Button(root,text='enter',width=3,height=1,bg='gold',fg='black')
button2.place(x = 140, y = 45)
button2.bind(“<Button-1>”, put)

root.mainloop()
rami
Нужны скобки везде после get:
 a = ent1.get()

Да, и вообще на форуме код нужно оборачивать в теги, чтобы правильно отображался.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB