窗口关闭时结束程序 [英] Ending a program when the window is closed

查看:21
本文介绍了窗口关闭时结束程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,当用户在我的网站上按下按钮时,它就会运行.有没有办法在关闭窗口时结束程序?否则,他们将继续接收短信.(这是使用 Flask 的 python 和 html)

I have a program that runs when a user presses a button on my website. Is there a way to end the program when they close the window? Otherwise they'll continue to receive text messages. (This is python and html using Flask)

推荐答案

这会帮助你 -

import sys

sys.exit() # Add this code when they close the website window

这篇关于窗口关闭时结束程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆