pygame学习
http://eyehere.net/2011/python-pygame-novice-professional-3/
http://www.pygame.org/docs/ref/event.html#pygame.event.get_blocked
event
pygame.event.pump — internally process pygame event handlers
pygame.event.get — get events from the queue
pygame.event.poll — get a single event from the queue
pygame.event.wait — wait for a single event from the queue
pygame.event.peek — test if event types are waiting on the queue
pygame.event.clear — remove all events from the queue
pygame.event.event_name — get the string name from and event id
pygame.event.set_blocked — control which events are allowed on the queue
pygame.event.set_allowed — control which events are allowed on the queue
pygame.event.get_blocked — test if a type of event is blocked from the queue
pygame.event.set_grab — control the sharing of input devices with other applications
pygame.event.get_grab — test if the program is sharing input devices
pygame.event.post — place a new event on the queue
pygame.event.Event — create a new event object
pygame.event.EventType — pygame object for representing SDL events
event interface
QUIT none
ACTIVEEVENT gain, state
KEYDOWN unicode, key, mod
KEYUP key, mod
MOUSEMOTION pos, rel, buttons
MOUSEBUTTONUP pos, button
MOUSEBUTTONDOWN pos, button
JOYAXISMOTION joy, axis, value
JOYBALLMOTION joy, ball, rel
JOYHATMOTION joy, hat, value
JOYBUTTONUP joy, button
JOYBUTTONDOWN joy, button
VIDEORESIZE size, w, h
VIDEOEXPOSE none
USEREVENT code
event_type
image :
pygame.image.load — load new image from a file
pygame.image.save — save an image to disk
pygame.image.get_extended — test if extended image formats can be loaded
pygame.image.tostring — transfer image to string buffer
pygame.image.fromstring — create new Surface from a string buffer
pygame.image.frombuffer — create a new Surface that shares data inside a string buffer
image interface
key:
pygame.key.get_focused — true if the display is receiving keyboard input from the system
pygame.key.get_pressed — get the state of all keyboard buttons
pygame.key.get_mods — determine which modifier keys are being held
pygame.key.set_mods — temporarily set which modifier keys are pressed
pygame.key.set_repeat — control how held keys are repeated
pygame.key.get_repeat — see how held keys are repeated
pygame.key.name — get the name of a key identifier
key interface
KeyASCII ASCII Common Name
K_BACKSPACE \b backspace
K_TAB \t tab
K_CLEAR clear
K_RETURN \r return
K_PAUSE pause
K_ESCAPE ^[ escape
K_SPACE space
K_EXCLAIM ! exclaim
K_QUOTEDBL " quotedbl
K_HASH # hash
K_DOLLAR $ dollar
K_AMPERSAND & ampersand
K_QUOTE quote
K_LEFTPAREN ( left parenthesis
K_RIGHTPAREN ) right parenthesis
K_ASTERISK * asterisk
K_PLUS + plus sign
K_COMMA , comma
K_MINUS - minus sign
K_PERIOD . period
K_SLASH / forward slash
K_0
K_1
K_2
K_3
K_4
K_5
K_6
K_7
K_8
K_9
K_COLON : colon
K_SEMICOLON ; semicolon
K_LESS < less-than sign
K_EQUALS = equals sign
K_GREATER > greater-than sign
K_QUESTION ? question mark
K_AT @ at
K_LEFTBRACKET [ left bracket
K_BACKSLASH \ backslash
K_RIGHTBRACKET ] right bracket
K_CARET ^ caret
K_UNDERSCORE _ underscore
K_BACKQUOTE ` grave
K_a a a
K_b b b
K_c c c
K_d d d
K_e e e
K_f f f
K_g g g
K_h h h
K_i i i
K_j j j
K_k k k
K_l l l
K_m m m
K_n n n
K_o o o
K_p p p
K_q q q
K_r r r
K_s s s
K_t t t
K_u u u
K_v v v
K_w w w
K_x x x
K_y y y
K_z z z
K_DELETE delete
K_KP0 keypad
K_KP1 keypad
K_KP2 keypad
K_KP3 keypad
K_KP4 keypad
K_KP5 keypad
K_KP6 keypad
K_KP7 keypad
K_KP8 keypad
K_KP9 keypad
K_KP_PERIOD . keypad period
K_KP_DIVIDE / keypad divide
K_KP_MULTIPLY * keypad multiply
K_KP_MINUS - keypad minus
K_KP_PLUS + keypad plus
K_KP_ENTER \r keypad enter
K_KP_EQUALS = keypad equals
K_UP up arrow
K_DOWN down arrow
K_RIGHT right arrow
K_LEFT left arrow
K_INSERT insert
K_HOME home
K_END end
K_PAGEUP page up
K_PAGEDOWN page down
K_F1 F1
K_F2 F2
K_F3 F3
K_F4 F4
K_F5 F5
K_F6 F6
K_F7 F7
K_F8 F8
K_F9 F9
K_F10 F10
K_F11 F11
K_F12 F12
K_F13 F13
K_F14 F14
K_F15 F15
K_NUMLOCK numlock
K_CAPSLOCK capslock
K_SCROLLOCK scrollock
K_RSHIFT right shift
K_LSHIFT left shift
K_RCTRL right control
K_LCTRL left control
K_RALT right alt
K_LALT left alt
K_RMETA right meta
K_LMETA left meta
K_LSUPER left Windows key
K_RSUPER right Windows key
K_MODE mode shift
K_HELP help
K_PRINT print screen
K_SYSREQ sysrq
K_BREAK break
K_MENU menu
K_POWER power
K_EURO Euro The keyboard also has a list of modifier states that can be assembled by bitwise-ORing them together. KMOD_NONE, KMOD_LSHIFT, KMOD_RSHIFT, KMOD_SHIFT, KMOD_CAPS,
KMOD_LCTRL, KMOD_RCTRL, KMOD_CTRL, KMOD_LALT, KMOD_RALT,
KMOD_ALT, KMOD_LMETA, KMOD_RMETA, KMOD_META, KMOD_NUM, KMOD_MODE
key type
mouse:
pygame.mouse.get_pressed — get the state of the mouse buttons
pygame.mouse.get_pos — get the mouse cursor position
pygame.mouse.get_rel — get the amount of mouse movement
pygame.mouse.set_pos — set the mouse cursor position
pygame.mouse.set_visible — hide or show the mouse cursor
pygame.mouse.get_focused — check if the display is receiving mouse input
pygame.mouse.set_cursor — set the image for the system mouse cursor
pygame.mouse.get_cursor — get the image for the system mouse cursor
mouse interface
cusor:
pygame.cursors.compile — create binary cursor data from simple strings
pygame.cursors.load_xbm — load cursor data from an XBM file
cursor interface
display
pygame.display.init — Initialize the display module
pygame.display.quit — Uninitialize the display module
pygame.display.get_init — Returns True if the display module has been initialized
pygame.display.set_mode — Initialize a window or screen for display
pygame.display.get_surface — Get a reference to the currently set display surface
pygame.display.flip — Update the full display Surface to the screen
pygame.display.update — Update portions of the screen for software displays
pygame.display.get_driver — Get the name of the pygame display backend
pygame.display.Info — Create a video display information object
pygame.display.get_wm_info — Get information about the current windowing system
pygame.display.list_modes — Get list of available fullscreen modes
pygame.display.mode_ok — Pick the best color depth for a display mode
pygame.display.gl_get_attribute — Get the value for an OpenGL flag for the current display
pygame.display.gl_set_attribute — Request an OpenGL display attribute for the display mode
pygame.display.get_active — Returns True when the display is active on the display
pygame.display.iconify — Iconify the display surface
pygame.display.toggle_fullscreen — Switch between fullscreen and windowed displays
pygame.display.set_gamma — Change the hardware gamma ramps
pygame.display.set_gamma_ramp — Change the hardware gamma ramps with a custom lookup
pygame.display.set_icon — Change the system image for the display window
pygame.display.set_caption — Set the current window caption
pygame.display.get_caption — Get the current window caption
pygame.display.set_palette — Set the display color palette for indexed displays
display interface
surface:
pygame.Surface.blit — draw one image onto another
pygame.Surface.convert — change the pixel format of an image
pygame.Surface.convert_alpha — change the pixel format of an image including per pixel alphas
pygame.Surface.copy — create a new copy of a Surface
pygame.Surface.fill — fill Surface with a solid color
pygame.Surface.scroll — Shift the surface image in place
pygame.Surface.set_colorkey — Set the transparent colorkey
pygame.Surface.get_colorkey — Get the current transparent colorkey
pygame.Surface.set_alpha — set the alpha value for the full Surface image
pygame.Surface.get_alpha — get the current Surface transparency value
pygame.Surface.lock — lock the Surface memory for pixel access
pygame.Surface.unlock — unlock the Surface memory from pixel access
pygame.Surface.mustlock — test if the Surface requires locking
pygame.Surface.get_locked — test if the Surface is current locked
pygame.Surface.get_locks — Gets the locks for the Surface
pygame.Surface.get_at — get the color value at a single pixel
pygame.Surface.set_at — set the color value for a single pixel
pygame.Surface.get_at_mapped — get the mapped color value at a single pixel
pygame.Surface.get_palette — get the color index palette for an -bit Surface
pygame.Surface.get_palette_at — get the color for a single entry in a palette
pygame.Surface.set_palette — set the color palette for an -bit Surface
pygame.Surface.set_palette_at — set the color for a single index in an -bit Surface palette
pygame.Surface.map_rgb — convert a color into a mapped color value
pygame.Surface.unmap_rgb — convert a mapped integer color value into a Color
pygame.Surface.set_clip — set the current clipping area of the Surface
pygame.Surface.get_clip — get the current clipping area of the Surface
pygame.Surface.subsurface — create a new surface that references its parent
pygame.Surface.get_parent — find the parent of a subsurface
pygame.Surface.get_abs_parent — find the top level parent of a subsurface
pygame.Surface.get_offset — find the position of a child subsurface inside a parent
pygame.Surface.get_abs_offset — find the absolute position of a child subsurface inside its top level parent
pygame.Surface.get_size — get the dimensions of the Surface
pygame.Surface.get_width — get the width of the Surface
pygame.Surface.get_height — get the height of the Surface
pygame.Surface.get_rect — get the rectangular area of the Surface
pygame.Surface.get_bitsize — get the bit depth of the Surface pixel format
pygame.Surface.get_bytesize — get the bytes used per Surface pixel
pygame.Surface.get_flags — get the additional flags used for the Surface
pygame.Surface.get_pitch — get the number of bytes used per Surface row
pygame.Surface.get_masks — the bitmasks needed to convert between a color and a mapped integer
pygame.Surface.set_masks — set the bitmasks needed to convert between a color and a mapped integer
pygame.Surface.get_shifts — the bit shifts needed to convert between a color and a mapped integer
pygame.Surface.set_shifts — sets the bit shifts needed to convert between a color and a mapped integer
pygame.Surface.get_losses — the significant bits used to convert between a color and a mapped integer
pygame.Surface.get_bounding_rect — find the smallest rect containing data
pygame.Surface.get_view — return a buffer view of the Surface’s pixels.
pygame.Surface.get_buffer — acquires a buffer object for the pixels of the Surface.
pygame.Surface._pixels_address — pixel buffer address
surface interface
pygame学习的更多相关文章
- pygame学习笔记(3)——时间、事件、文字
转载请注明:@小五义 http://www.cnblogs.com/xiaowuyi 1.运动速率 上节中,实现了一辆汽车在马路上由下到上行驶,并使用了pygame.time.delay(200 ...
- PyGame学习笔记之壹
新建窗口 代码 '''PyGame学习笔记之壹''' import pygame # 引入 PyGame 库 pygame.init() # PyGame 库初始化 screen = pygame.d ...
- 用pygame学习初级python(一) 15.4.19
最近有计划要学一下python,主要是要用flask.django一些框架进行后端的学习工作,但是在web应用之前希望进行一些基础的项目进行一些语法的练习,熟悉一下写法, 这个时候我就想先做几个小游戏 ...
- pygame学习笔记(4)——声音
转载请注明:@小五义 http://www.cnblogs.com/xiaowuyi pygame.mixer是一个用来处理声音的模块,其含义为“混音器”.游戏中对声音的处理一般包括制造声音和播放声音 ...
- pygame学习笔记(5)——精灵
转载请注明:@小五义 http://www.cnblogs.com/xiaowuyi 据说在任天堂FC时代,精灵的作用相当巨大,可是那时候只知道怎么玩超级玛丽.魂斗罗,却对精灵一点也不知.pygame ...
- pygame学习笔记(1)——安装及矩形、圆型画图
pygame是一个设计用来开发游戏的python模块,其实说白了和time.os.sys都是一样的东东.今天开始正式学习pygame,下载地址:www.pygame.org.下载后安装完成即可,在py ...
- Python之pygame学习绘制文字制作滚动文字
pygame绘制文字 ✕ 今天来学习绘制文本内容,毕竟游戏中还是需要文字对玩家提示一些有用的信息. 字体常用的不是很多,在pygame中大多用于提示文字,或者记录分数等事件. 字体绘制基本分为以下几个 ...
- pygame学习笔记
pygame参考文档pdf版:pygame API html版 pygame API 石头剪子布的简单小游戏,待改进的地方,自适应大小.感兴趣的小伙伴可以依据get_surface()返回值(即当前窗 ...
- 用pygame学习初级python(二) 15.5.11
闲得无聊,对第一版的东西做了一些修改,让它更像一个游戏,也具有一些可玩性. 项目的github地址:https://github.com/lfkdsk/BrainHole_pygame 1.人物类进行 ...
- pygame学习资料
pygame下载地址: https://bitbucket.org/pygame/pygame/downloads 12岁的少年教你用Python做小游戏 Beginning Game Program ...
随机推荐
- 初识Asp.Net WebApi
using System;using System.Collections.Generic;using System.Linq;using System.Net.Http;using System.T ...
- python 文本比对
# -*- coding:utf-8 -*- import difflib import sys def readfile(filename): try: fileHandle = open(file ...
- webpack4.0学习记录
2019/04/28 1.本质上,webpack基于node node跟webpack为最新稳定版,才能更好,更快的打包 安装 1.卸载node 直接在控制面板 卸载 2.安装 从官网下载 然后 ...
- 微信商户/H5支付申请 被拒原因:网站存在不实内容或不安全信息
看到这张图片,申请H5支付的朋友估计是崩溃的,被拒的原因是网站存在不实内容或不安全信息. 解决方法有两种: 针对不安全内容,则是微信支付审核团队认为你的网站存在安全漏洞的,需要修复. 针对不实内容,则 ...
- Mybatis 常用注解
Mybatis常用注解对应的目标和标签如表所示: 注解 目标 对应的XML标签 @CacheNamespace 类 <cache> @CacheNamespaceRef 类 <cac ...
- ubuntu命令安装
1.当make时,发现没有对应的命令: apt-get install build-essential 安装工具,可解决这个问题
- 配置ssh无密码登陆Linux
Windows下面的话需要安装git,或者其他能执行shell命令的软件 1.首先要先修改SSH的配置文件 vi /etc/ssh/sshd_config#修改配置文件 #如果被#注释了,就取消#号, ...
- hostapd、/dev/random、/dev/urandom
在使用hostapd做软ap时,出现了random熵不够的问题,导致节点连接不上这个ap. 下面先解释一下/dev/random和/dev/urandom 先让我们从一个工程中遇到的实际问题开始,先上 ...
- 洛谷 P2678 & [NOIP2015提高组] 跳石头
题目链接 https://www.luogu.org/problemnew/show/P2678 题目背景 一年一度的“跳石头”比赛又要开始了! 题目描述 这项比赛将在一条笔直的河道中进行,河道中分布 ...
- python输入一行字符,判断不同字符数量
输入一行字符,判断不同字符的数量, 分别用for循环和while循环完成 for循环 运用了字符串方法, isupper()判断是否为大写字母 islower()判断是否为小写字母 isdigit() ...