wie behebe ich diesen fehler?

1 Antwort

1) Bei der Definition des command für deinen Button rufst du die Funktion neum direkt auf. Das heißt, ihr Rückgabewert (None) wird anschließend dem Argument command zugewiesen.

Richtig wäre die Übergabe einer Funktionsreferenz:

knopf = ctk.CTkButton(main, text="n", command=neum)

2) Die Fehlermeldung

TypeError: 'module' object is not subscriptable

weist daraufhin, dass du ein Modul so behandelst, als sei es ein Objekt.

Beispiel:

# --- a.py ---
a = { "test": 123 }

# --- b.py ---
import a
print(a["test"]) # error: a is the module, not the dict

# --- c.py ---
import a
print(a.a["test"]) # 123

# --- d.py ---
from a import a
# or: from a import *
print(a["test"]) # 123