Français
Ouvrir dans Telegram

MessageДобрый вечер. Помогите пожалуйста. Каким методом можно реализовать кнопку stop в нижеприведенном примере, если подразуме…

30 novembre 2020
C
Добрый вечер. Помогите пожалуйста. Каким методом можно реализовать кнопку stop в нижеприведенном примере, если подразумевается что при нажатии на кнопку stop поток должен быть убит. Вот код. from threading import Thread import time import tkinter as tk def a(): while True: print("OK") time.sleep(1) def start(): global t t = Thread(target=a, args=(), daemon=True) t.start() def stop(): #t.kill() pass root = tk.Tk() b1 = tk.Button(text='start', command=start) b1.pack() b2 = tk.Button(text='stop', command=stop) b2.pack() root.mainloop()

À proximité dans le fil

ДДмитрийТебе в @python_scripts_hrААлексей ИвановБлагодарю бро
ce message
🥢🥢Огосики😄🥢🥢Quit() нет?)
ССообщество Python ПрограммистовСообщество Python Программистов@python_scripts · groupe · Technologie
4 169membres43écrivent en 30 jours
Fil de la communauté Ouvrir dans Telegram

Un fil public ouvert issu de l'index de recherche ChatCrawler — « le Google du Telegram public » ; actualisé à mesure que la communauté est explorée. Les heures sont en UTC.

Contenu public uniquement, API officielle de Telegram. À propos · FAQ · Limites de l'index · Retirer une page · Catalogue · Recherche · Comment nous comptons