当前位置:网站首页>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 .边栏推荐
- Unforgettable summary of 2021
- Unconventional ending disconnected from the target VM, address: '127.0.0.1:62635', transport: 'socket‘
- The mutual realization of C L stack and queue in I
- I 用c I 实现队列
- QT small case "addition calculator"
- Explanation of parallel search set theory and code implementation
- Clickhouse database installation deployment and remote IP access
- How to delete the virus of inserting USB flash disk copy of shortcut to
- What does soda ash do?
- PostMessage communication
猜你喜欢

1290_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS

Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required

Mathematical analysis_ Notes_ Chapter 8: multiple integral

I 用c I 实现队列

And let's play dynamic proxy (extreme depth version)

DelayQueue延迟队列的使用和场景

The mutual realization of C L stack and queue in I

IPage can display data normally, but total is always equal to 0

【Node】nvm 版本管理工具
![[vscode] prohibit the pylance plug-in from automatically adding import](/img/a7/d96c0c4739ff68356c15bafbbb1328.jpg)
[vscode] prohibit the pylance plug-in from automatically adding import
随机推荐
Batch convert txt to excel format
How to deal with excessive memory occupation of idea and Google browser
Implementation of one-dimensional convolutional neural network CNN based on FPGA (VIII) implementation of activation layer
(top) pretty girl binary color code portal
M2DGR 多源多场景 地面机器人SLAM数据集
CADD课程学习(6)-- 获得已有的虚拟化合物库(Drugbank、ZINC)
HDU1232 畅通工程(并查集)
Idea shortcut key
What is soda?
SD_ CMD_ RECEIVE_ SHIFT_ REGISTER
Don't confuse the use difference between series / and / *
Basic series of SHEL script (II) syntax + operation + judgment
Qu'est - ce que l'hydroxyde de sodium?
Word import literature -mendeley
Negative number storage and type conversion in programs
Explanation of parallel search set theory and code implementation
Use go language to read TXT file and write it into Excel
What if the DataGrid cannot see the table after connecting to the database
CADD课程学习(5)-- 构建靶点已知的化合结构(ChemDraw)
Graduation thesis project local deployment practice