猫史档案馆


【Python作品分享】新的作品【教程贴】

用户:搬码喵搬码喵查看:0 回复:0 评论:0 创建时间:2021-11-26T21:13:00


【作品展示】

center_image

 

【作品介绍】

n

 

【作品源代码】

import pygame
from pygame.locals import*
import sys


pygame.init()
size = width, height = 400, 400
screen = pygame.display.set_mode(size)
pygame.display.set_caption('键盘测试')
pygame.mouse.set_visible(0)
while True:
	for event in pygame.event.get():
		if event.type == pygame.KEYDOWN:
			print("单击键盘输入")
			print("该键位的key为:", event.key)
			print("该键位的Unicode为:", event.unicode)
		if event.type == pygame.QUIT:
			sys.exit()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页