当前位置:网站首页>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 .边栏推荐
- Use go language to read TXT file and write it into Excel
- Rough notes of C language (2) -- constants
- 借助 Navicat for MySQL 软件 把 不同或者相同数据库链接中的某数据库表数据 复制到 另一个数据库表中
- [OBS] x264 Code: "buffer_size“
- Typescript get timestamp
- Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘
- Target detection series - detailed explanation of the principle of fast r-cnn
- Implementation of one-dimensional convolutional neural network CNN based on FPGA (VIII) implementation of activation layer
- Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
- Three body goal management notes
猜你喜欢
![[software testing] 03 -- overview of software testing](/img/1e/0b6458160e34e43f021ea4797de70a.jpg)
[software testing] 03 -- overview of software testing

The number of occurrences of numbers in the offer 56 array (XOR)

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

(tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements

Rough notes of C language (1)

Chapter 2: try to implement a simple bean container

Hdu1232 unimpeded project (and collection)

Daily Practice:Codeforces Round #794 (Div. 2)(A~D)

Solve tensorfow GPU modulenotfounderror: no module named 'tensorflow_ core. estimator‘

Play with grpc - go deep into concepts and principles
随机推荐
Mathematical analysis_ Notes_ Chapter 8: multiple integral
Typescript get timestamp
2022.06.27_ One question per day
The difference between NPM install -g/-save/-save-dev
Import CV2, prompt importerror: libcblas so. 3: cannot open shared object file: No such file or directory
【Node】nvm 版本管理工具
Don't confuse the use difference between series / and / *
[software testing] 06 -- basic process of software testing
Cookie operation
Explanation of parallel search set theory and code implementation
GPIO port bit based on Cortex-M3 and M4 with operation macro definition (can be used for bus input and output, STM32, aducm4050, etc.)
Rough notes of C language (2) -- constants
The problem of configuring opencv in qt5.13.2 is solved in detail
NPM and package common commands
大学生活的自我总结-大一
SOC_ SD_ CMD_ FSM
Netease to B, soft outside, hard in
Simple use of timeunit
(top) pretty girl binary color code portal
[framework] multi learner