当前位置:网站首页>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 .
边栏推荐
- 【Node】npm、yarn、pnpm 区别
- I 用c I 实现队列
- Mathematical analysis_ Notes_ Chapter 8: multiple integral
- I can't stand the common annotations of idea anymore
- PostMessage communication
- NPM and package common commands
- Using GEE plug-in in QGIS
- 2022 PMP project management examination agile knowledge points (7)
- Miracast技术详解(一):Wi-Fi Display
- CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
猜你喜欢
I 用c I 实现队列
Machine learning Seaborn visualization
The problem of configuring opencv in qt5.13.2 is solved in detail
Don't confuse the use difference between series / and / *
Detailed explanation of miracast Technology (I): Wi Fi display
Unforgettable summary of 2021
Brief description of inux camera (Mipi interface)
Anaconda navigator click open no response, can not start error prompt attributeerror: 'STR' object has no attribute 'get‘
Miracast技术详解(一):Wi-Fi Display
611. 有效三角形的个数
随机推荐
公安基础知识--fb
Rough notes of C language (2) -- constants
How to delete the virus of inserting USB flash disk copy of shortcut to
GPIO port bit based on Cortex-M3 and M4 with operation macro definition (can be used for bus input and output, STM32, aducm4050, etc.)
Basic knowledge of public security -- FB
Course learning accumulation ppt
2022年PMP项目管理考试敏捷知识点(7)
玩转gRPC—深入概念与原理
What is soda?
What if the DataGrid cannot see the table after connecting to the database
The difference between NPM install -g/-save/-save-dev
And let's play dynamic proxy (extreme depth version)
[vscode] search using regular expressions
Shadowless cloud desktop - online computer
The problem of configuring opencv in qt5.13.2 is solved in detail
[software testing] 02 -- software defect management
SOC_ SD_ DATA_ FSM
I 用c l 栈与队列的相互实现
(top) pretty girl binary color code portal
arcpy. SpatialJoin_ Analysis spatial connection analysis