当前位置:网站首页>Exit of pyGame, idle and pycharm
Exit of pyGame, idle and pycharm
2022-07-05 07:28:00 【work-harder】
background :
win8.1, python3.9.7, idle(3.9.7), pycharm(2021.3.1)
Purpose :
pygame After operation , Click on “x" after , The interface closes when exiting , There is no need for the system to automatically prompt whether to close the program
The phenomenon :
1. The method given in a lecture is as follows ( The editor is pycharm), You can really see the program exit smoothly :
if event.type == pygame.QUIT:
print("Game Over") # Test statement
exit()
2. I use it python Self contained idle, Results run pygame After the app , The running window appears normally ( Code name A). Click on "x" after , There is no exit window (A), There's no hint . But according to the added test statements (print sentence ), Yes, I did . It turned out , There is a warning pop-up that requires the user to confirm whether to exit “ hide ” Behind the running window .
3. Change the above exit code to the following ,idle and pycharm Can exit normally , No additional confirmation is required .
if event.type == pygame.QUIT: # The front has import pygame
print("Game Over") # Test statement
pygame.quit() # Don't add this line ,idle Middle window cannot exit
sys.exit() # The front has import sys; direct exit(), Can't quit .
边栏推荐
- Don't confuse the use difference between series / and / *
- Idea shortcut key
- arcpy. SpatialJoin_ Analysis spatial connection analysis
- 并查集理论讲解和代码实现
- The SQL implementation has multiple records with the same ID, and the latest one is taken
- Line test -- data analysis -- FB -- teacher Gao Zhao
- Simple use of timeunit
- M2DGR 多源多场景 地面机器人SLAM数据集
- Use of Pai platform
- Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
猜你喜欢
Graduation thesis project local deployment practice
玩转gRPC—深入概念与原理
Machine learning Seaborn visualization
DataGrid offline installation of database driver
CADD课程学习(6)-- 获得已有的虚拟化合物库(Drugbank、ZINC)
Unforgettable summary of 2021
Miracast技术详解(一):Wi-Fi Display
Solve tensorfow GPU modulenotfounderror: no module named 'tensorflow_ core. estimator‘
Mathematical analysis_ Notes_ Chapter 8: multiple integral
[software testing] 03 -- overview of software testing
随机推荐
611. Number of effective triangles
Application of MATLAB in Linear Algebra (4): similar matrix and quadratic form
[idea] efficient plug-in save actions to improve your work efficiency
Ue5 hot update - remote server automatic download and version detection (simplehotupdate)
Basic series of SHEL script (III) for while loop
UE5热更新-远端服务器自动下载和版本检测(SimpleHotUpdate)
Batch convert txt to excel format
Detailed explanation of miracast Technology (I): Wi Fi display
GBK error in web page Chinese display (print, etc.), solution
Delayqueue usage and scenarios of delay queue
Install deeptools in CONDA mode
And play the little chestnut of dynamic agent
【idea】Could not autowire. No beans of xxx type found
借助 Navicat for MySQL 软件 把 不同或者相同数据库链接中的某数据库表数据 复制到 另一个数据库表中
CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
Graduation thesis project local deployment practice
Course learning accumulation ppt
QT small case "addition calculator"
Rough notes of C language (2) -- constants
并查集理论讲解和代码实现