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 ...
随机推荐
- word20170102日用家电 household appliances
1. Vacuum cleaner: 吸尘器 2.Cordless vacuum cleaner: 无线吸尘器 3.Robotic vacuum cleaner: 机器人吸尘器 动词:to vacuu ...
- IIS部署项目
控制面板\所有控制面板项\管理工具-->Internet 信息服务(IIS)管理器 随便填个名称,项目的路径,选择一个新的端口.
- important覆盖行内样式
优先级,外部样式<内部样式<行内样式,后台富文本编辑器编辑的正文显示在前台时可用!important覆盖其行内样式 今天的问题,font-family:"思源黑体 CN!impo ...
- Maven - pom中的<repository> <pluginRepositories>
总结: <repository> 允许我们可以在POM中配置其它的远程仓库.这样做的原因有很多,比如你有一个局域网的远程仓库,使用该仓库能大大提高下载速度,继而提高构建速度,也有可能你依赖 ...
- BFS 模拟队列(水题)
BFS 这道题 觉得比较适合BFS新手入门写,也许大家都以为最入门 的BFS题是在二维图上搜索,但是这道题是线性搜索,更加简单 POJ 3278 Catch That Cow Time Limit: ...
- 微信小程序的桌面图标问题
提问: 笔者在发布小程序后,发现无法在安卓手机创建桌面图标,而其它的小程序却可以. 回答: 在小程序后台页面(从公众平台进入)完整填写小程序的信息,之后便可创建桌面图标. 这可能是微信的某种筛查机制在 ...
- 01pxc集群的部署
尽可能的控制pxc集群的规模,pxc集群节点越多,数据同步的速度就越慢 所有pxc节点的硬件配置最好相同,pxc集群数据同步的速度取决于配置最低的节点 Pxc集群只支持innodb引擎 安装pxc集群 ...
- LeetCode.接雨水
题外话:LeetCode上一个测试用例总是通不过(我在文章末贴出通不过的测试用例),给的原因是超出运行时间,我拿那个测试用例试了下2.037ms运行完.我自己强行给加了这句: && m ...
- NOIP2018Day1T1 铺设道路
题目描述 春春是一名道路工程师,负责铺设一条长度为 \(n\) 的道路. 铺设道路的主要工作是填平下陷的地表.整段道路可以看作是 \(n\) 块首尾相连的区域,一开始,第 \(i\) 块区域下陷的深度 ...
- java - day003 - 循环嵌套, 循环命名, while, 数组
1.循环嵌套 break 中断循环或switch(跳出循环).中断后继续往下执行 continue (跳到循环的下一轮继续执行) return (结束方法) 2.循环命名 内层循环控制外层循环.需要给 ...