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.getget 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           0       0
K_1           1       1
K_2           2       2
K_3           3       3
K_4           4       4
K_5           5       5
K_6           6       6
K_7           7       7
K_8           8       8
K_9           9       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 0
K_KP1                 keypad 1
K_KP2                 keypad 2
K_KP3                 keypad 3
K_KP4                 keypad 4
K_KP5                 keypad 5
K_KP6                 keypad 6
K_KP7                 keypad 7
K_KP8                 keypad 8
K_KP9                 keypad 9
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.locklock 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 8-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 8-bit Surface
pygame.Surface.set_palette_at     —     set the color for a single index in an 8-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

 

posted @ 2017-11-06 13:42  chencesc  阅读(304)  评论(0编辑  收藏  举报