Извините, что беспокою вас, но я хотел бы попросить о помощи. Мое приложение tkinter зависает, когда я вызываю метод Neural_network, потому что оно прерывает основной цикл. Я пытался добавить потоки, но это не сработало так, как задумано. Если бы кто-то мог помочь мне, я был бы очень признателен. Спасибо!
class Toplevel1:
def __init__(self, top=None):
def neural_network(p1,p2,p3,p4,p5):
#NEURAL NETWORK STUFF GOING ON HERE
print(round(prediction.item(0)))
if round(prediction.item(0)) == 1: self.Label1_6.configure(text='''Malignant''', foreground="red")
else: self.Label1_6.configure(text='''Benign''', foreground="green")
def call_neural(p1, p2, p3, p4, p5):
self.Label1_6.configure(text='''Please wait...''', foreground="black")
root.after(10000, neural_network(p1, p2, p3, p4, p5))
def analytics():
try:
float(self.Entry1_3.get())
float(self.Entry1_4.get())
float(self.Entry1_5.get())
float(self.Entry1_6.get())
float(self.Entry1_7.get())
p1 = (float(self.Entry1_3.get()) - 6.981) / (21.129)
p2 = (float(self.Entry1_4.get()) - 43.79) / (144.71)
p3 = (float(self.Entry1_5.get()) - 143.5) / (2357.5)
p4 = (float(self.Entry1_6.get()) - 0.01938) / (0.32602)
p5 = (float(self.Entry1_7.get()) - 0) / (0.4268)
if 0 <= p1 <= 1 and 0 <= p2 <= 1 and 0 <= p3 <= 1 and 0 <= p4 <= 1 and 0 <= p5 <= 1: call_neural(p1, p2, p3, p4, p5)
else: self.Label1_6.configure(text='''Error: Out of bounds''')
except ValueError:
self.Label1_6.configure(text='''Please fill all fields''')