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 ...
随机推荐
- git 命令详细
git是代码管理工具 github是基于git实现的代码管理平台 git --version 查看git版本 git remote -v 查看clone地址 git init 初始化git //全局设 ...
- 2018-2019-2 20165234 《网络对抗技术》 Exp1 PC平台逆向破解
实验一 PC平台逆向破解 实验目的 本次实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函数会简单回显任何用户输入的字符串. 该程序同时包含另 ...
- python3三角函数
三角函数 acos(x) 返回x的反余弦弧度值. asin(x) 返回x的反正弦弧度值. atan(x) 返回x的反正切弧度值. atan2(y, x) 返回给定的 X 及 Y 坐标值的反正切 ...
- 2018-2019-1 20165231 实现mypwd(选做)
实现mypwd 要求: 学习pwd命令 研究pwd实现需要的系统调用(man -k; grep),写出伪代码 实现mypwd 测试mypwd pwd: 在Linux层次结构中,想要知道当前所处的目录, ...
- chrome扩展程序----域名助手
音乐分享: Future Islands - <Aladdin> 中年大叔的抖腿新专辑<The Far Field> ————————————————————————————— ...
- react給變量賦值并列元素
今天在使用react時發現一個問題:我在給一個變量賦值多個元素,但不能用div包含起來. 如: var p = <div> <p></p> <p>< ...
- fiddler限制网速
在测试过程中,经常会要求测试弱网络情况时的一些特殊情况,这时候IOS还好说,在开发者选项中调整网络模式即可,但android就只能通过别的方式了,这里整理了通过fiddler抓包工具来设置弱网模式,在 ...
- MQTT初步使用
环境搭建 1.mosquitto所需要的rpm包 2.c-ares-1.12.0 3.安装最新的openssl版本 4.mosquitto-1.4.10 mosquitto需要的rpm包 c-ares ...
- JQuery ajax 前后端传值介绍
https://jingyan.baidu.com/album/ca41422f0bf08e1eae99ed04.html?picindex=5 现在我们话不多说,开始仔细讲解一下我们ajax内部传递 ...
- 洛谷 P2820 局域网
题目链接 https://www.luogu.org/problemnew/show/P2820 题目背景 某个局域网内有n(n<=100)台计算机,由于搭建局域网时工作人员的疏忽,现在局域网内 ...