Python中文
首页
教程
问答
标签
搜索
登录
注册
如何退出并在一个循环中打印事件
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<pre><code>import pygame pygame.init() x = height,width = (800,600) Display = pygame.display.set_mode(x) pygame.display.set_caption("Blocky") red = (157, 139, 215) black = (0,0,0) Display.fill(red) pygame.draw.rect(Display,black,(120,450,600,50)) #It updates every frame pygame.display.update() excape = False while not excape: for dork in pygame.event.get(): print(dork) if pygame.event == pygame.QUIT: pygame.quit() quit() </code></pre> <p><a href="https://i.stack.imgur.com/6Jdxm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Jdxm.png" alt="Here's the result"/></a></p> <p>这里的打印(呆子)是工作,但当我点击退出按钮的窗口,它没有退出在所有。。 那么如何在1 while循环中打印事件并退出应用程序呢?你知道吗</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>您需要循环检查每个pygame事件,并检查该事件是否为退出。你知道吗</p> <pre><code>while not excape: for event in pygame.event.get(): print(event) if event.type == pygame.QUIT: pygame.quit() excape = True </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在python中从数据帧列中删除分类值?
7 回答
如何在python中从数据帧列表中删除引号
4 回答
如何在python中从数据帧创建列表
8 回答
如何在Python中从数据帧创建嵌套的JSON
1 回答
如何在Python中从数据帧显示wordcloud
5 回答
如何在Python中从数据帧的时间戳中删除字符
9 回答
如何在Python中从数据帧绘制简单绘图?
7 回答
如何在python中从数据帧行提取具有特定长度的范围?
2 回答
如何在python中从数据帧设置dict中的值
4 回答
如何在Python中从数据库中获得一个结果
8 回答
如何在python中从数据框中绘制分类条形图
6 回答
如何在Python中从数据框中选择特定细节?
4 回答
如何在python中从数据集中删除unicode
10 回答
如何在python中从数据集中删除某些数值?
8 回答
如何在python中从数据集中选择行
6 回答
如何在Python中从数组中删除元素
7 回答
如何在python中从数组中删除单个倒逗号?
6 回答
如何在python中从数组中删除对象?
10 回答
如何在python中从数组中删除引号
5 回答
如何在python中从数组中删除所有最小值
9 回答