XXI_BEK
@XXI_BEK
Студент

Как исправить ошибку tkinter Python?

Есть множество функций, вот несколько из них:
def intersection():
    z_shaped_1 = subs[0].get().split(';')
    z_shaped_1 = [float(item) for item in z_shaped_1]
    shape_1 = combos[0].get()
    custom_shaped_1 = subs[1].get().split(';')
    custom_shaped_1 = [float(item) for item in custom_shaped_1]
    s_shaped_1 = subs[2].get().split(';')
    s_shaped_1 = [float(item) for item in s_shaped_1]

    operation = operations.get()

    z_shaped_2 = subs[3].get().split(';')
    z_shaped_2 = [float(item) for item in z_shaped_2]
    shape_2 = combos[1].get()
    custom_shaped_2 = subs[4].get().split(';')
    custom_shaped_2 = [float(item) for item in custom_shaped_2]
    s_shaped_2 = subs[4].get().split(';')
    s_shaped_2 = [float(item) for item in s_shaped_2]

    execute(z_shaped_1, shape_1, custom_shaped_1, s_shaped_1, operation, z_shaped_2, shape_2, custom_shaped_2,
            s_shaped_2)
    return

def execute(z_shaped_1, shape_1, custom_shaped_1, s_shaped_1, operation, z_shaped_2, shape_2, custom_shaped_2,
            s_shaped_2):
    x1, y1 = generate_function(z_shaped_1, shape_1, custom_shaped_1, s_shaped_1)
    x2, y2 = generate_function(z_shaped_2, shape_2, custom_shaped_2, s_shaped_2)

    x1, y1, x2, y2 = leveling(x1, y1, x2, y2)

    new_y = perform_an_action(x1, y1, y2, operation)

    print(len(x1) == len(x2))
    print(len(x1) == len(new_y))
    pplot(x1, y1, shape_1, shape_1)
    pplot(x2, y2, shape_2, shape_2)
    pplot(x2, new_y, operation, operation)
    return None

def pplot(x, y, figure, title):
    plt.figure(figure)
    plt.plot(x, y)
    plt.title(title)
    plt.show()
    return None


При отработке обработчика кнопки выдает ошибку (обработчик кнопки 1-я функция)
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\tkinter\__init__.py", line 1948, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "E:\python\FuzzyNumberCalculator\main.py", line 42, in intersection
    execute(z_shaped_1, shape_1, custom_shaped_1, s_shaped_1, operation, z_shaped_2, shape_2, custom_shaped_2,
TypeError: 'Button' object is not callable

Собственно ругается на execute
PS: функция execute лежит в src/Source.py
  • Вопрос задан
  • 107 просмотров
Решения вопроса 1
Vindicar
@Vindicar
RTFM!
Значит, ты в какой-то момент делаешь в глобальной области видимости присваивание вида execute = tkinter.Button(...)
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы