write()
 writes a list of midi data to the Output write(data) -> None  Writes series of MIDI information in the form of a list.
Parameters:

data (list) -- data to write, the expected format is [[[status, data1=0, data2=0, ...], timestamp], ...] with the data# fields being optional
Raises:

IndexError -- if more than 1024 elements in the data list    Example: # Program change at time 20000 and 500ms later send note 65 with
# velocity 100.
write([[[0xc0, 0, 0], 20000], [[0x90, 60, 100], 20500]])  Note  Timestamps will be ignored if latency = 0 To get a note to play immediately, send MIDI info with timestamp read from function Time Optional data fields: write([[[0xc0, 0, 0], 20000]]) is equivalent to write([[[0xc0], 20000]])


write_short()
 writes up to 3 bytes of midi data to the Output write_short(status) -> None write_short(status, data1=0, data2=0) -> None  Output MIDI information of 3 bytes or less. The data fields are optional and assumed to be 0 if omitted. Examples of status byte values: 0xc0  # program change
0x90  # note on
# etc. Example: # note 65 on with velocity 100
write_short(0x90, 65, 100)


write_sys_ex()
 writes a timestamped system-exclusive midi message. write_sys_ex(when, msg) -> None  Writes a timestamped system-exclusive midi message.
Parameters:

msg (list[int] or str) -- midi message
when -- timestamp in milliseconds      Example: midi_output.write_sys_ex(0, '\xF0\x7D\x10\x11\x12\x13\xF7')

# is equivalent to

midi_output.write_sys_ex(pygame.midi.time(),
                         [0xF0, 0x7D, 0x10, 0x11, 0x12, 0x13, 0xF7])


pygame.midi.quit()
 uninitialize the midi module quit() -> None  Uninitializes the pygame.midi module. If pygame.midi.init() was called to initialize the pygame.midi module, then this function will be called automatically when your program exits. It is safe to call this function more than once.


pygame.midi.time()
 returns the current time in ms of the PortMidi timer time() -> time  The time is reset to 0 when the pygame.midi module is initialized.


pygame.mixer

 pygame module for loading and playing sounds  This module contains classes for loading Sound objects and controlling playback. The mixer module is optional and depends on SDL_mixer. Your program should test that pygame.mixer is available and initialized before using it. The mixer module has a limited number of channels for playback of sounds. Usually programs tell pygame to start playing audio and it selects an available channel automatically. The default is 8 simultaneous channels, but complex programs can get more precise control over the number of channels and their use. All sound playback is mixed in background threads. When you begin to play a Sound object, it will return immediately while the sound continues to play. A single Sound object can also be actively played back multiple times. The mixer also has a special streaming channel. This is for music playback and is accessed through the pygame.mixer.music module. The mixer module must be initialized like other pygame modules, but it has some extra conditions. The pygame.mixer.init() function takes several optional arguments to control the playback rate and sample size. Pygame will default to reasonable values, but pygame cannot perform Sound resampling, so the mixer should be initialized to match the values of your audio resources. NOTE: For less laggy sound use a smaller buffer size. The default is set to reduce the chance of scratchy sounds on some computers. You can change the default buffer by calling pygame.mixer.pre_init() before pygame.mixer.init() or pygame.init() is called. For example: pygame.mixer.pre_init(44100,-16,2, 1024)   pygame.mixer.init()
 initialize the mixer module init(frequency=44100, size=-16, channels=2, buffer=512, devicename=None, allowedchanges=AUDIO_ALLOW_FREQUENCY_CHANGE | AUDIO_ALLOW_CHANNELS_CHANGE) -> None  Initialize the mixer module for Sound loading and playback. The default arguments can be overridden to provide specific audio mixing. Keyword arguments are accepted. For backward compatibility where an argument is set zero the default value is used (possible changed by a pre_init call). The size argument represents how many bits are used for each audio sample. If the value is negative then signed sample values will be used. Positive values mean unsigned audio samples will be used. An invalid value raises an exception. The channels argument is used to specify whether to use mono or stereo. 1 for mono and 2 for stereo. The buffer argument controls the number of internal samples used in the sound mixer. The default value should work for most cases. It can be lowered to reduce latency, but sound dropout may occur. It can be raised to larger values to ensure playback never skips, but it will impose latency on sound playback. The buffer size must be a power of two (if not it is rounded up to the next nearest power of 2). Some platforms require the pygame.mixer module to be initialized after the display modules have initialized. The top level pygame.init() takes care of this automatically, but cannot pass any arguments to the mixer init. To solve this, mixer has a function pygame.mixer.pre_init() to set the proper defaults before the toplevel init is used. When using allowedchanges=0 it will convert the samples at runtime to match what the hardware supports. For example a sound card may not support 16bit sound samples, so instead it will use 8bit samples internally. If AUDIO_ALLOW_FORMAT_CHANGE is supplied, then the requested format will change to the closest that SDL2 supports. Apart from 0, allowedchanged accepts the following constants ORed together:
 AUDIO_ALLOW_FREQUENCY_CHANGE AUDIO_ALLOW_FORMAT_CHANGE AUDIO_ALLOW_CHANNELS_CHANGE AUDIO_ALLOW_ANY_CHANGE
 It is safe to call this more than once, but after the mixer is initialized you cannot change the playback arguments without first calling pygame.mixer.quit().  Changed in pygame 1.8: The default buffersize was changed from 1024 to 3072.   Changed in pygame 1.9.1: The default buffersize was changed from 3072 to 4096.   Changed in pygame 2.0.0: The default buffersize was changed from 4096 to 512. The default frequency changed to 44100 from 22050.   Changed in pygame 2.0.0: size can be 32 (32bit floats).   Changed in pygame 2.0.0: channels can also be 4 or 6.   New in pygame 2.0.0: allowedchanges argument added
   pygame.mixer.pre_init()
 preset the mixer init arguments pre_init(frequency=44100, size=-16, channels=2, buffer=512, devicename=None) -> None  Call pre_init to change the defaults used when the real pygame.mixer.init() is called. Keyword arguments are accepted. The best way to set custom mixer playback values is to call pygame.mixer.pre_init() before calling the top level pygame.init(). For backward compatibility argument values of zero are replaced with the startup defaults.  Changed in pygame 1.8: The default buffersize was changed from 1024 to 3072.   Changed in pygame 1.9.1: The default buffersize was changed from 3072 to 4096.   Changed in pygame 2.0.0: The default buffersize was changed from 4096 to 512. The default frequency changed to 44100 from 22050.
   pygame.mixer.quit()
 uninitialize the mixer quit() -> None  This will uninitialize pygame.mixer. All playback will stop and any loaded Sound objects may not be compatible with the mixer if it is reinitialized later.
   pygame.mixer.get_init()
 test if the mixer is initialized get_init() -> (frequency, format, channels)  If the mixer is initialized, this returns the playback arguments it is using. If the mixer has not been initialized this returns None.
   pygame.mixer.stop()
 stop playback of all sound channels stop() -> None  This will stop all playback of all active mixer channels.
   pygame.mixer.pause()
 temporarily stop playback of all sound channels pause() -> None  This will temporarily stop all playback on the active mixer channels. The playback can later be resumed with pygame.mixer.unpause()
   pygame.mixer.unpause()
 resume paused playback of sound channels unpause() -> None  This will resume all active sound channels after they have been paused.
   pygame.mixer.fadeout()
 fade out the volume on all sounds before stopping fadeout(time) -> None  This will fade out the volume on all active channels over the time argument in milliseconds. After the sound is muted the playback will stop.
   pygame.mixer.set_num_channels()
 set the total number of playback channels set_num_channels(count) -> None  Sets the number of available channels for the mixer. The default value is 8. The value can be increased or decreased. If the value is decreased, sounds playing on the truncated channels are stopped.
   pygame.mixer.get_num_channels()
 get the total number of playback channels get_num_channels() -> count  Returns the number of currently active playback channels.
   pygame.mixer.set_reserved()
 reserve channels from being automatically used set_reserved(count) -> None  The mixer can reserve any number of channels that will not be automatically selected for playback by Sounds. If sounds are currently playing on the reserved channels they will not be stopped. This allows the application to reserve a specific number of channels for important sounds that must not be dropped or have a guaranteed channel to play on.
   pygame.mixer.find_channel()
 find an unused channel find_channel(force=False) -> Channel  This will find and return an inactive Channel object. If there are no inactive Channels this function will return None. If there are no inactive channels and the force argument is True, this will find the Channel with the longest running Sound and return it. If the mixer has reserved channels from pygame.mixer.set_reserved() then those channels will not be returned here.
   pygame.mixer.get_busy()
 test if any sound is being mixed get_busy() -> bool  Returns True if the mixer is busy mixing any channels. If the mixer is idle then this return False.
   pygame.mixer.get_sdl_mixer_version()
 get the mixer's SDL version get_sdl_mixer_version() -> (major, minor, patch) get_sdl_mixer_version(linked=True) -> (major, minor, patch)
Parameters:

linked (bool) -- if True (default) the linked version number is returned, otherwise the compiled version number is returned
Returns:
the mixer's SDL library version number (linked or compiled depending on the linked parameter) as a tuple of 3 integers (major, minor, patch)

Return type:
tuple     Note The linked and compile version numbers should be the same.   New in pygame 2.0.0.
   pygame.mixer.Sound
 Create a new Sound object from a file or buffer object Sound(filename) -> Sound Sound(file=filename) -> Sound Sound(buffer) -> Sound Sound(buffer=buffer) -> Sound Sound(object) -> Sound Sound(file=object) -> Sound Sound(array=object) -> Sound  Load a new sound buffer from a filename, a python file object or a readable buffer object. Limited resampling will be performed to help the sample match the initialize arguments for the mixer. A Unicode string can only be a file pathname. A Python 2.x string or a Python 3.x bytes object can be either a pathname or a buffer object. Use the 'file' or 'buffer' keywords to avoid ambiguity; otherwise Sound may guess wrong. If the array keyword is used, the object is expected to export a version 3, C level array interface or, for Python 2.6 or later, a new buffer interface (The object is checked for a buffer interface first.) The Sound object represents actual sound sample data. Methods that change the state of the Sound object will the all instances of the Sound playback. A Sound object also exports an array interface, and, for Python 2.6 or later, a new buffer interface. The Sound can be loaded from an OGG audio file or from an uncompressed WAV. Note: The buffer will be copied internally, no data will be shared between it and the Sound object. For now buffer and array support is consistent with sndarray.make_sound for Numeric arrays, in that sample sign and byte order are ignored. This will change, either by correctly handling sign and byte order, or by raising an exception when different. Also, source samples are truncated to fit the audio sample size. This will not change.  New in pygame 1.8: pygame.mixer.Sound(buffer)   New in pygame 1.9.2: pygame.mixer.Sound keyword arguments and array interface support    play()
 begin sound playback play(loops=0, maxtime=0, fade_ms=0) -> Channel  Begin playback of the Sound (i.e., on the computer's speakers) on an available Channel. This will forcibly select a Channel, so playback may cut off a currently playing sound if necessary. The loops argument controls how many times the sample will be repeated after being played the first time. A value of 5 means that the sound will be played once, then repeated five times, and so is played a total of six times. The default value (zero) means the Sound is not repeated, and so is only played once. If loops is set to -1 the Sound will loop indefinitely (though you can still call stop() to stop it). The maxtime argument can be used to stop playback after a given number of milliseconds. The fade_ms argument will make the sound start playing at 0 volume and fade up to full volume over the time given. The sample may end before the fade-in is complete. This returns the Channel object for the channel that was selected.
   stop()
 stop sound playback stop() -> None  This will stop the playback of this Sound on any active Channels.
   fadeout()
 stop sound playback after fading out fadeout(time) -> None  This will stop playback of the sound after fading it out over the time argument in milliseconds. The Sound will fade and stop on all actively playing channels.
   set_volume()
 set the playback volume for this Sound set_volume(value) -> None  This will set the playback volume (loudness) for this Sound. This will immediately affect the Sound if it is playing. It will also affect any future playback of this Sound.
Parameters:

value (float) -- volume in the range of 0.0 to 1.0 (inclusive)  If value < 0.0, the volume will not be changed If value > 1.0, the volume will be set to 1.0
   get_volume()
 get the playback volume get_volume() -> value  Return a value from 0.0 to 1.0 representing the volume for this Sound.
   get_num_channels()
 count how many times this Sound is playing get_num_channels() -> count  Return the number of active channels this sound is playing on.
   get_length()
 get the length of the Sound get_length() -> seconds  Return the length of this Sound in seconds.
   get_raw()
 return a bytestring copy of the Sound samples. get_raw() -> bytes  Return a copy of the Sound object buffer as a bytes (for Python 3.x) or str (for Python 2.x) object.  New in pygame 1.9.2.

   pygame.mixer.Channel
 Create a Channel object for controlling playback Channel(id) -> Channel  Return a Channel object for one of the current channels. The id must be a value from 0 to the value of pygame.mixer.get_num_channels(). The Channel object can be used to get fine control over the playback of Sounds. A channel can only playback a single Sound at time. Using channels is entirely optional since pygame can manage them by default.   play()
 play a Sound on a specific Channel play(Sound, loops=0, maxtime=0, fade_ms=0) -> None  This will begin playback of a Sound on a specific Channel. If the Channel is currently playing any other Sound it will be stopped. The loops argument has the same meaning as in Sound.play(): it is the number of times to repeat the sound after the first time. If it is 3, the sound will be played 4 times (the first time, then three more). If loops is -1 then the playback will repeat indefinitely. As in Sound.play(), the maxtime argument can be used to stop playback of the Sound after a given number of milliseconds. As in Sound.play(), the fade_ms argument can be used fade in the sound.
   stop()
 stop playback on a Channel stop() -> None  Stop sound playback on a channel. After playback is stopped the channel becomes available for new Sounds to play on it.
   pause()
 temporarily stop playback of a channel pause() -> None  Temporarily stop the playback of sound on a channel. It can be resumed at a later time with Channel.unpause()
   unpause()
 resume pause playback of a channel unpause() -> None  Resume the playback on a paused channel.
   fadeout()
 stop playback after fading channel out fadeout(time) -> None  Stop playback of a channel after fading out the sound over the given time argument in milliseconds.
   set_volume()
 set the volume of a playing channel set_volume(value) -> None set_volume(left, right) -> None  Set the volume (loudness) of a playing sound. When a channel starts to play its volume value is reset. This only affects the current sound. The value argument is between 0.0 and 1.0. If one argument is passed, it will be the volume of both speakers. If two arguments are passed and the mixer is in stereo mode, the first argument will be the volume of the left speaker and the second will be the volume of the right speaker. (If the second argument is None, the first argument will be the volume of both speakers.) If the channel is playing a Sound on which set_volume() has also been called, both calls are taken into account. For example: sound = pygame.mixer.Sound("s.wav")
channel = s.play()      # Sound plays at full volume by default
sound.set_volume(0.9)   # Now plays at 90% of full volume.
sound.set_volume(0.6)   # Now plays at 60% (previous value replaced).
channel.set_volume(0.5) # Now plays at 30% (0.6 * 0.5).
   get_volume()
 get the volume of the playing channel get_volume() -> value  Return the volume of the channel for the current playing sound. This does not take into account stereo separation used by Channel.set_volume(). The Sound object also has its own volume which is mixed with the channel.
   get_busy()
 check if the channel is active get_busy() -> bool  Returns True if the channel is actively mixing sound. If the channel is idle this returns False.
   get_sound()
 get the currently playing Sound get_sound() -> Sound  Return the actual Sound object currently playing on this channel. If the channel is idle None is returned.
   queue()
 queue a Sound object to follow the current queue(Sound) -> None  When a Sound is queued on a Channel, it will begin playing immediately after the current Sound is finished. Each channel can only have a single Sound queued at a time. The queued Sound will only play if the current playback finished automatically. It is cleared on any other call to Channel.stop() or Channel.play(). If there is no sound actively playing on the Channel then the Sound will begin playing immediately.
   get_queue()
 return any Sound that is queued get_queue() -> Sound  If a Sound is already queued on this channel it will be returned. Once the queued sound begins playback it will no longer be on the queue.
   set_endevent()
 have the channel send an event when playback stops set_endevent() -> None set_endevent(type) -> None  When an endevent is set for a channel, it will send an event to the pygame queue every time a sound finishes playing on that channel (not just the first time). Use pygame.event.get() to retrieve the endevent once it's sent. Note that if you called Sound.play(n) or Channel.play(sound,n), the end event is sent only once: after the sound has been played "n+1" times (see the documentation of Sound.play). If Channel.stop() or Channel.play() is called while the sound was still playing, the event will be posted immediately. The type argument will be the event id sent to the queue. This can be any valid event type, but a good choice would be a value between pygame.locals.USEREVENT and pygame.locals.NUMEVENTS. If no type argument is given then the Channel will stop sending endevents.
   get_endevent()
 get the event a channel sends when playback stops get_endevent() -> type  Returns the event type to be sent every time the Channel finishes playback of a Sound. If there is no endevent the function returns pygame.NOEVENT.


pygame.mixer.Channel
 Create a Channel object for controlling playback Channel(id) -> Channel  Return a Channel object for one of the current channels. The id must be a value from 0 to the value of pygame.mixer.get_num_channels(). The Channel object can be used to get fine control over the playback of Sounds. A channel can only playback a single Sound at time. Using channels is entirely optional since pygame can manage them by default.   play()
 play a Sound on a specific Channel play(Sound, loops=0, maxtime=0, fade_ms=0) -> None  This will begin playback of a Sound on a specific Channel. If the Channel is currently playing any other Sound it will be stopped. The loops argument has the same meaning as in Sound.play(): it is the number of times to repeat the sound after the first time. If it is 3, the sound will be played 4 times (the first time, then three more). If loops is -1 then the playback will repeat indefinitely. As in Sound.play(), the maxtime argument can be used to stop playback of the Sound after a given number of milliseconds. As in Sound.play(), the fade_ms argument can be used fade in the sound.
   stop()
 stop playback on a Channel stop() -> None  Stop sound playback on a channel. After playback is stopped the channel becomes available for new Sounds to play on it.
   pause()
 temporarily stop playback of a channel pause() -> None  Temporarily stop the playback of sound on a channel. It can be resumed at a later time with Channel.unpause()
   unpause()
 resume pause playback of a channel unpause() -> None  Resume the playback on a paused channel.
   fadeout()
 stop playback after fading channel out fadeout(time) -> None  Stop playback of a channel after fading out the sound over the given time argument in milliseconds.
   set_volume()
 set the volume of a playing channel set_volume(value) -> None set_volume(left, right) -> None  Set the volume (loudness) of a playing sound. When a channel starts to play its volume value is reset. This only affects the current sound. The value argument is between 0.0 and 1.0. If one argument is passed, it will be the volume of both speakers. If two arguments are passed and the mixer is in stereo mode, the first argument will be the volume of the left speaker and the second will be the volume of the right speaker. (If the second argument is None, the first argument will be the volume of both speakers.) If the channel is playing a Sound on which set_volume() has also been called, both calls are taken into account. For example: sound = pygame.mixer.Sound("s.wav")
channel = s.play()      # Sound plays at full volume by default
sound.set_volume(0.9)   # Now plays at 90% of full volume.
sound.set_volume(0.6)   # Now plays at 60% (previous value replaced).
channel.set_volume(0.5) # Now plays at 30% (0.6 * 0.5).
   get_volume()
 get the volume of the playing channel get_volume() -> value  Return the volume of the channel for the current playing sound. This does not take into account stereo separation used by Channel.set_volume(). The Sound object also has its own volume which is mixed with the channel.
   get_busy()
 check if the channel is active get_busy() -> bool  Returns True if the channel is actively mixing sound. If the channel is idle this returns False.
   get_sound()
 get the currently playing Sound get_sound() -> Sound  Return the actual Sound object currently playing on this channel. If the channel is idle None is returned.
   queue()
 queue a Sound object to follow the current queue(Sound) -> None  When a Sound is queued on a Channel, it will begin playing immediately after the current Sound is finished. Each channel can only have a single Sound queued at a time. The queued Sound will only play if the current playback finished automatically. It is cleared on any other call to Channel.stop() or Channel.play(). If there is no sound actively playing on the Channel then the Sound will begin playing immediately.
   get_queue()
 return any Sound that is queued get_queue() -> Sound  If a Sound is already queued on this channel it will be returned. Once the queued sound begins playback it will no longer be on the queue.
   set_endevent()
 have the channel send an event when playback stops set_endevent() -> None set_endevent(type) -> None  When an endevent is set for a channel, it will send an event to the pygame queue every time a sound finishes playing on that channel (not just the first time). Use pygame.event.get() to retrieve the endevent once it's sent. Note that if you called Sound.play(n) or Channel.play(sound,n), the end event is sent only once: after the sound has been played "n+1" times (see the documentation of Sound.play). If Channel.stop() or Channel.play() is called while the sound was still playing, the event will be posted immediately. The type argument will be the event id sent to the queue. This can be any valid event type, but a good choice would be a value between pygame.locals.USEREVENT and pygame.locals.NUMEVENTS. If no type argument is given then the Channel will stop sending endevents.
   get_endevent()
 get the event a channel sends when playback stops get_endevent() -> type  Returns the event type to be sent every time the Channel finishes playback of a Sound. If there is no endevent the function returns pygame.NOEVENT.


fadeout()
 stop playback after fading channel out fadeout(time) -> None  Stop playback of a channel after fading out the sound over the given time argument in milliseconds.


get_busy()
 check if the channel is active get_busy() -> bool  Returns True if the channel is actively mixing sound. If the channel is idle this returns False.


get_endevent()
 get the event a channel sends when playback stops get_endevent() -> type  Returns the event type to be sent every time the Channel finishes playback of a Sound. If there is no endevent the function returns pygame.NOEVENT.


get_queue()
 return any Sound that is queued get_queue() -> Sound  If a Sound is already queued on this channel it will be returned. Once the queued sound begins playback it will no longer be on the queue.


get_sound()
 get the currently playing Sound get_sound() -> Sound  Return the actual Sound object currently playing on this channel. If the channel is idle None is returned.


get_volume()
 get the volume of the playing channel get_volume() -> value  Return the volume of the channel for the current playing sound. This does not take into account stereo separation used by Channel.set_volume(). The Sound object also has its own volume which is mixed with the channel.


pause()
 temporarily stop playback of a channel pause() -> None  Temporarily stop the playback of sound on a channel. It can be resumed at a later time with Channel.unpause()


play()
 play a Sound on a specific Channel play(Sound, loops=0, maxtime=0, fade_ms=0) -> None  This will begin playback of a Sound on a specific Channel. If the Channel is currently playing any other Sound it will be stopped. The loops argument has the same meaning as in Sound.play(): it is the number of times to repeat the sound after the first time. If it is 3, the sound will be played 4 times (the first time, then three more). If loops is -1 then the playback will repeat indefinitely. As in Sound.play(), the maxtime argument can be used to stop playback of the Sound after a given number of milliseconds. As in Sound.play(), the fade_ms argument can be used fade in the sound.


queue()
 queue a Sound object to follow the current queue(Sound) -> None  When a Sound is queued on a Channel, it will begin playing immediately after the current Sound is finished. Each channel can only have a single Sound queued at a time. The queued Sound will only play if the current playback finished automatically. It is cleared on any other call to Channel.stop() or Channel.play(). If there is no sound actively playing on the Channel then the Sound will begin playing immediately.


set_endevent()
 have the channel send an event when playback stops set_endevent() -> None set_endevent(type) -> None  When an endevent is set for a channel, it will send an event to the pygame queue every time a sound finishes playing on that channel (not just the first time). Use pygame.event.get() to retrieve the endevent once it's sent. Note that if you called Sound.play(n) or Channel.play(sound,n), the end event is sent only once: after the sound has been played "n+1" times (see the documentation of Sound.play). If Channel.stop() or Channel.play() is called while the sound was still playing, the event will be posted immediately. The type argument will be the event id sent to the queue. This can be any valid event type, but a good choice would be a value between pygame.locals.USEREVENT and pygame.locals.NUMEVENTS. If no type argument is given then the Channel will stop sending endevents.


set_volume()
 set the volume of a playing channel set_volume(value) -> None set_volume(left, right) -> None  Set the volume (loudness) of a playing sound. When a channel starts to play its volume value is reset. This only affects the current sound. The value argument is between 0.0 and 1.0. If one argument is passed, it will be the volume of both speakers. If two arguments are passed and the mixer is in stereo mode, the first argument will be the volume of the left speaker and the second will be the volume of the right speaker. (If the second argument is None, the first argument will be the volume of both speakers.) If the channel is playing a Sound on which set_volume() has also been called, both calls are taken into account. For example: sound = pygame.mixer.Sound("s.wav")
channel = s.play()      # Sound plays at full volume by default
sound.set_volume(0.9)   # Now plays at 90% of full volume.
sound.set_volume(0.6)   # Now plays at 60% (previous value replaced).
channel.set_volume(0.5) # Now plays at 30% (0.6 * 0.5).


stop()
 stop playback on a Channel stop() -> None  Stop sound playback on a channel. After playback is stopped the channel becomes available for new Sounds to play on it.


unpause()
 resume pause playback of a channel unpause() -> None  Resume the playback on a paused channel.


pygame.mixer.fadeout()
 fade out the volume on all sounds before stopping fadeout(time) -> None  This will fade out the volume on all active channels over the time argument in milliseconds. After the sound is muted the playback will stop.


pygame.mixer.find_channel()
 find an unused channel find_channel(force=False) -> Channel  This will find and return an inactive Channel object. If there are no inactive Channels this function will return None. If there are no inactive channels and the force argument is True, this will find the Channel with the longest running Sound and return it. If the mixer has reserved channels from pygame.mixer.set_reserved() then those channels will not be returned here.


pygame.mixer.get_busy()
 test if any sound is being mixed get_busy() -> bool  Returns True if the mixer is busy mixing any channels. If the mixer is idle then this return False.


pygame.mixer.get_init()
 test if the mixer is initialized get_init() -> (frequency, format, channels)  If the mixer is initialized, this returns the playback arguments it is using. If the mixer has not been initialized this returns None.


pygame.mixer.get_num_channels()
 get the total number of playback channels get_num_channels() -> count  Returns the number of currently active playback channels.


pygame.mixer.get_sdl_mixer_version()
 get the mixer's SDL version get_sdl_mixer_version() -> (major, minor, patch) get_sdl_mixer_version(linked=True) -> (major, minor, patch)
Parameters:

linked (bool) -- if True (default) the linked version number is returned, otherwise the compiled version number is returned
Returns:
the mixer's SDL library version number (linked or compiled depending on the linked parameter) as a tuple of 3 integers (major, minor, patch)

Return type:
tuple     Note The linked and compile version numbers should be the same.   New in pygame 2.0.0.


pygame.mixer.init()
 initialize the mixer module init(frequency=44100, size=-16, channels=2, buffer=512, devicename=None, allowedchanges=AUDIO_ALLOW_FREQUENCY_CHANGE | AUDIO_ALLOW_CHANNELS_CHANGE) -> None  Initialize the mixer module for Sound loading and playback. The default arguments can be overridden to provide specific audio mixing. Keyword arguments are accepted. For backward compatibility where an argument is set zero the default value is used (possible changed by a pre_init call). The size argument represents how many bits are used for each audio sample. If the value is negative then signed sample values will be used. Positive values mean unsigned audio samples will be used. An invalid value raises an exception. The channels argument is used to specify whether to use mono or stereo. 1 for mono and 2 for stereo. The buffer argument controls the number of internal samples used in the sound mixer. The default value should work for most cases. It can be lowered to reduce latency, but sound dropout may occur. It can be raised to larger values to ensure playback never skips, but it will impose latency on sound playback. The buffer size must be a power of two (if not it is rounded up to the next nearest power of 2). Some platforms require the pygame.mixer module to be initialized after the display modules have initialized. The top level pygame.init() takes care of this automatically, but cannot pass any arguments to the mixer init. To solve this, mixer has a function pygame.mixer.pre_init() to set the proper defaults before the toplevel init is used. When using allowedchanges=0 it will convert the samples at runtime to match what the hardware supports. For example a sound card may not support 16bit sound samples, so instead it will use 8bit samples internally. If AUDIO_ALLOW_FORMAT_CHANGE is supplied, then the requested format will change to the closest that SDL2 supports. Apart from 0, allowedchanged accepts the following constants ORed together:
 AUDIO_ALLOW_FREQUENCY_CHANGE AUDIO_ALLOW_FORMAT_CHANGE AUDIO_ALLOW_CHANNELS_CHANGE AUDIO_ALLOW_ANY_CHANGE
 It is safe to call this more than once, but after the mixer is initialized you cannot change the playback arguments without first calling pygame.mixer.quit().  Changed in pygame 1.8: The default buffersize was changed from 1024 to 3072.   Changed in pygame 1.9.1: The default buffersize was changed from 3072 to 4096.   Changed in pygame 2.0.0: The default buffersize was changed from 4096 to 512. The default frequency changed to 44100 from 22050.   Changed in pygame 2.0.0: size can be 32 (32bit floats).   Changed in pygame 2.0.0: channels can also be 4 or 6.   New in pygame 2.0.0: allowedchanges argument added


pygame.mixer.music

 pygame module for controlling streamed audio  The music module is closely tied to pygame.mixer. Use the music module to control the playback of music in the sound mixer. The difference between the music playback and regular Sound playback is that the music is streamed, and never actually loaded all at once. The mixer system only supports a single music stream at once. Be aware that MP3 support is limited. On some systems an unsupported format can crash the program, e.g. Debian Linux. Consider using OGG instead.   pygame.mixer.music.load()
 Load a music file for playback load(filename) -> None load(object) -> None  This will load a music filename/file object and prepare it for playback. If a music stream is already playing it will be stopped. This does not start the music playing.
   pygame.mixer.music.unload()
 Unload the currently loaded music to free up resources unload() -> None  This closes resources like files for any music that may be loaded.  New in pygame 2.0.0.
   pygame.mixer.music.play()
 Start the playback of the music stream play(loops=0, start=0.0, fade_ms = 0) -> None  This will play the loaded music stream. If the music is already playing it will be restarted. loops is an optional integer argument, which is 0 by default, it tells how many times to repeat the music. The music repeats indefinately if this argument is set to -1. start is an optional float argument, which is 0.0 by default, which denotes the position in time, the music starts playing from. The starting position depends on the format of the music played. MP3 and OGG use the position as time in seconds. For mp3s the start time position selected may not be accurate as things like variable bit rate encoding and ID3 tags can throw off the timing calculations. For MOD music it is the pattern order number. Passing a start position will raise a NotImplementedError if the start position cannot be set. fade_ms is an optional integer argument, which is 0 by default, makes the music start playing at 0 volume and fade up to full volume over the given time. The sample may end before the fade-in is complete.  Changed in pygame 2.0.0: Added optional fade_ms argument
   pygame.mixer.music.rewind()
 restart music rewind() -> None  Resets playback of the current music to the beginning.
   pygame.mixer.music.stop()
 stop the music playback stop() -> None  Stops the music playback if it is currently playing. It Won't Unload the music.
   pygame.mixer.music.pause()
 temporarily stop music playback pause() -> None  Temporarily stop playback of the music stream. It can be resumed with the pygame.mixer.music.unpause() function.
   pygame.mixer.music.unpause()
 resume paused music unpause() -> None  This will resume the playback of a music stream after it has been paused.
   pygame.mixer.music.fadeout()
 stop music playback after fading out fadeout(time) -> None  Fade out and stop the currently playing music. The time argument denotes the integer milliseconds for which the fading effect is generated. Note, that this function blocks until the music has faded out. Calls to fadeout() and set_volume() will have no effect during this time. If an event was set using set_endevent() it will be called after the music has faded.
   pygame.mixer.music.set_volume()
 set the music volume set_volume(volume) -> None  Set the volume of the music playback. The volume argument is a float between 0.0 and 1.0 that sets volume. When new music is loaded the volume is reset to full volume.
   pygame.mixer.music.get_volume()
 get the music volume get_volume() -> value  Returns the current volume for the mixer. The value will be between 0.0 and 1.0.
   pygame.mixer.music.get_busy()
 check if the music stream is playing get_busy() -> bool  Returns True when the music stream is actively playing. When the music is idle this returns False. In pygame 2.0.1 and above this function returns False when the music is paused. In pygame 1 it returns True when the music is paused.  Changed in pygame 2.0.1: Returns False when music paused.
   pygame.mixer.music.set_pos()
 set position to play from set_pos(pos) -> None  This sets the position in the music file where playback will start. The meaning of "pos", a float (or a number that can be converted to a float), depends on the music format. For MOD files, pos is the integer pattern number in the module. For OGG it is the absolute position, in seconds, from the beginning of the sound. For MP3 files, it is the relative position, in seconds, from the current position. For absolute positioning in an MP3 file, first call rewind(). Other file formats are unsupported. Newer versions of SDL_mixer have better positioning support than earlier ones. An SDLError is raised if a particular format does not support positioning. Function set_pos() calls underlining SDL_mixer function Mix_SetMusicPosition.  New in pygame 1.9.2.
   pygame.mixer.music.get_pos()
 get the music play time get_pos() -> time  This gets the number of milliseconds that the music has been playing for. The returned time only represents how long the music has been playing; it does not take into account any starting position offsets.
   pygame.mixer.music.queue()
 queue a sound file to follow the current queue(filename) -> None  This will load a sound file and queue it. A queued sound file will begin as soon as the current sound naturally ends. Only one sound can be queued at a time. Queuing a new sound while another sound is queued will result in the new sound becoming the queued sound. Also, if the current sound is ever stopped or changed, the queued sound will be lost. The following example will play music by Bach six times, then play music by Mozart once: pygame.mixer.music.load('bach.ogg')
pygame.mixer.music.play(5)        # Plays six times, not five!
pygame.mixer.music.queue('mozart.ogg')
   pygame.mixer.music.set_endevent()
 have the music send an event when playback stops set_endevent() -> None set_endevent(type) -> None  This causes pygame to signal (by means of the event queue) when the music is done playing. The argument determines the type of event that will be queued. The event will be queued every time the music finishes, not just the first time. To stop the event from being queued, call this method with no argument.
   pygame.mixer.music.get_endevent()
 get the event a channel sends when playback stops get_endevent() -> type  Returns the event type to be sent every time the music finishes playback. If there is no endevent the function returns pygame.NOEVENT.


pygame.mixer.music.fadeout()
 stop music playback after fading out fadeout(time) -> None  Fade out and stop the currently playing music. The time argument denotes the integer milliseconds for which the fading effect is generated. Note, that this function blocks until the music has faded out. Calls to fadeout() and set_volume() will have no effect during this time. If an event was set using set_endevent() it will be called after the music has faded.


pygame.mixer.music.get_busy()
 check if the music stream is playing get_busy() -> bool  Returns True when the music stream is actively playing. When the music is idle this returns False. In pygame 2.0.1 and above this function returns False when the music is paused. In pygame 1 it returns True when the music is paused.  Changed in pygame 2.0.1: Returns False when music paused.


pygame.mixer.music.get_endevent()
 get the event a channel sends when playback stops get_endevent() -> type  Returns the event type to be sent every time the music finishes playback. If there is no endevent the function returns pygame.NOEVENT.


pygame.mixer.music.get_pos()
 get the music play time get_pos() -> time  This gets the number of milliseconds that the music has been playing for. The returned time only represents how long the music has been playing; it does not take into account any starting position offsets.


pygame.mixer.music.get_volume()
 get the music volume get_volume() -> value  Returns the current volume for the mixer. The value will be between 0.0 and 1.0.


pygame.mixer.music.load()
 Load a music file for playback load(filename) -> None load(object) -> None  This will load a music filename/file object and prepare it for playback. If a music stream is already playing it will be stopped. This does not start the music playing.


pygame.mixer.music.pause()
 temporarily stop music playback pause() -> None  Temporarily stop playback of the music stream. It can be resumed with the pygame.mixer.music.unpause() function.


pygame.mixer.music.play()
 Start the playback of the music stream play(loops=0, start=0.0, fade_ms = 0) -> None  This will play the loaded music stream. If the music is already playing it will be restarted. loops is an optional integer argument, which is 0 by default, it tells how many times to repeat the music. The music repeats indefinately if this argument is set to -1. start is an optional float argument, which is 0.0 by default, which denotes the position in time, the music starts playing from. The starting position depends on the format of the music played. MP3 and OGG use the position as time in seconds. For mp3s the start time position selected may not be accurate as things like variable bit rate encoding and ID3 tags can throw off the timing calculations. For MOD music it is the pattern order number. Passing a start position will raise a NotImplementedError if the start position cannot be set. fade_ms is an optional integer argument, which is 0 by default, makes the music start playing at 0 volume and fade up to full volume over the given time. The sample may end before the fade-in is complete.  Changed in pygame 2.0.0: Added optional fade_ms argument


pygame.mixer.music.queue()
 queue a sound file to follow the current queue(filename) -> None  This will load a sound file and queue it. A queued sound file will begin as soon as the current sound naturally ends. Only one sound can be queued at a time. Queuing a new sound while another sound is queued will result in the new sound becoming the queued sound. Also, if the current sound is ever stopped or changed, the queued sound will be lost. The following example will play music by Bach six times, then play music by Mozart once: pygame.mixer.music.load('bach.ogg')
pygame.mixer.music.play(5)        # Plays six times, not five!
pygame.mixer.music.queue('mozart.ogg')


pygame.mixer.music.rewind()
 restart music rewind() -> None  Resets playback of the current music to the beginning.


pygame.mixer.music.set_endevent()
 have the music send an event when playback stops set_endevent() -> None set_endevent(type) -> None  This causes pygame to signal (by means of the event queue) when the music is done playing. The argument determines the type of event that will be queued. The event will be queued every time the music finishes, not just the first time. To stop the event from being queued, call this method with no argument.


pygame.mixer.music.set_pos()
 set position to play from set_pos(pos) -> None  This sets the position in the music file where playback will start. The meaning of "pos", a float (or a number that can be converted to a float), depends on the music format. For MOD files, pos is the integer pattern number in the module. For OGG it is the absolute position, in seconds, from the beginning of the sound. For MP3 files, it is the relative position, in seconds, from the current position. For absolute positioning in an MP3 file, first call rewind(). Other file formats are unsupported. Newer versions of SDL_mixer have better positioning support than earlier ones. An SDLError is raised if a particular format does not support positioning. Function set_pos() calls underlining SDL_mixer function Mix_SetMusicPosition.  New in pygame 1.9.2.


pygame.mixer.music.set_volume()
 set the music volume set_volume(volume) -> None  Set the volume of the music playback. The volume argument is a float between 0.0 and 1.0 that sets volume. When new music is loaded the volume is reset to full volume.


pygame.mixer.music.stop()
 stop the music playback stop() -> None  Stops the music playback if it is currently playing. It Won't Unload the music.


pygame.mixer.music.unload()
 Unload the currently loaded music to free up resources unload() -> None  This closes resources like files for any music that may be loaded.  New in pygame 2.0.0.


pygame.mixer.music.unpause()
 resume paused music unpause() -> None  This will resume the playback of a music stream after it has been paused.


pygame.mixer.pause()
 temporarily stop playback of all sound channels pause() -> None  This will temporarily stop all playback on the active mixer channels. The playback can later be resumed with pygame.mixer.unpause()


pygame.mixer.pre_init()
 preset the mixer init arguments pre_init(frequency=44100, size=-16, channels=2, buffer=512, devicename=None) -> None  Call pre_init to change the defaults used when the real pygame.mixer.init() is called. Keyword arguments are accepted. The best way to set custom mixer playback values is to call pygame.mixer.pre_init() before calling the top level pygame.init(). For backward compatibility argument values of zero are replaced with the startup defaults.  Changed in pygame 1.8: The default buffersize was changed from 1024 to 3072.   Changed in pygame 1.9.1: The default buffersize was changed from 3072 to 4096.   Changed in pygame 2.0.0: The default buffersize was changed from 4096 to 512. The default frequency changed to 44100 from 22050.


pygame.mixer.quit()
 uninitialize the mixer quit() -> None  This will uninitialize pygame.mixer. All playback will stop and any loaded Sound objects may not be compatible with the mixer if it is reinitialized later.


pygame.mixer.set_num_channels()
 set the total number of playback channels set_num_channels(count) -> None  Sets the number of available channels for the mixer. The default value is 8. The value can be increased or decreased. If the value is decreased, sounds playing on the truncated channels are stopped.


pygame.mixer.set_reserved()
 reserve channels from being automatically used set_reserved(count) -> None  The mixer can reserve any number of channels that will not be automatically selected for playback by Sounds. If sounds are currently playing on the reserved channels they will not be stopped. This allows the application to reserve a specific number of channels for important sounds that must not be dropped or have a guaranteed channel to play on.


pygame.mixer.Sound
 Create a new Sound object from a file or buffer object Sound(filename) -> Sound Sound(file=filename) -> Sound Sound(buffer) -> Sound Sound(buffer=buffer) -> Sound Sound(object) -> Sound Sound(file=object) -> Sound Sound(array=object) -> Sound  Load a new sound buffer from a filename, a python file object or a readable buffer object. Limited resampling will be performed to help the sample match the initialize arguments for the mixer. A Unicode string can only be a file pathname. A Python 2.x string or a Python 3.x bytes object can be either a pathname or a buffer object. Use the 'file' or 'buffer' keywords to avoid ambiguity; otherwise Sound may guess wrong. If the array keyword is used, the object is expected to export a version 3, C level array interface or, for Python 2.6 or later, a new buffer interface (The object is checked for a buffer interface first.) The Sound object represents actual sound sample data. Methods that change the state of the Sound object will the all instances of the Sound playback. A Sound object also exports an array interface, and, for Python 2.6 or later, a new buffer interface. The Sound can be loaded from an OGG audio file or from an uncompressed WAV. Note: The buffer will be copied internally, no data will be shared between it and the Sound object. For now buffer and array support is consistent with sndarray.make_sound for Numeric arrays, in that sample sign and byte order are ignored. This will change, either by correctly handling sign and byte order, or by raising an exception when different. Also, source samples are truncated to fit the audio sample size. This will not change.  New in pygame 1.8: pygame.mixer.Sound(buffer)   New in pygame 1.9.2: pygame.mixer.Sound keyword arguments and array interface support    play()
 begin sound playback play(loops=0, maxtime=0, fade_ms=0) -> Channel  Begin playback of the Sound (i.e., on the computer's speakers) on an available Channel. This will forcibly select a Channel, so playback may cut off a currently playing sound if necessary. The loops argument controls how many times the sample will be repeated after being played the first time. A value of 5 means that the sound will be played once, then repeated five times, and so is played a total of six times. The default value (zero) means the Sound is not repeated, and so is only played once. If loops is set to -1 the Sound will loop indefinitely (though you can still call stop() to stop it). The maxtime argument can be used to stop playback after a given number of milliseconds. The fade_ms argument will make the sound start playing at 0 volume and fade up to full volume over the time given. The sample may end before the fade-in is complete. This returns the Channel object for the channel that was selected.
   stop()
 stop sound playback stop() -> None  This will stop the playback of this Sound on any active Channels.
   fadeout()
 stop sound playback after fading out fadeout(time) -> None  This will stop playback of the sound after fading it out over the time argument in milliseconds. The Sound will fade and stop on all actively playing channels.
   set_volume()
 set the playback volume for this Sound set_volume(value) -> None  This will set the playback volume (loudness) for this Sound. This will immediately affect the Sound if it is playing. It will also affect any future playback of this Sound.
Parameters:

value (float) -- volume in the range of 0.0 to 1.0 (inclusive)  If value < 0.0, the volume will not be changed If value > 1.0, the volume will be set to 1.0
   get_volume()
 get the playback volume get_volume() -> value  Return a value from 0.0 to 1.0 representing the volume for this Sound.
   get_num_channels()
 count how many times this Sound is playing get_num_channels() -> count  Return the number of active channels this sound is playing on.
   get_length()
 get the length of the Sound get_length() -> seconds  Return the length of this Sound in seconds.
   get_raw()
 return a bytestring copy of the Sound samples. get_raw() -> bytes  Return a copy of the Sound object buffer as a bytes (for Python 3.x) or str (for Python 2.x) object.  New in pygame 1.9.2.


fadeout()
 stop sound playback after fading out fadeout(time) -> None  This will stop playback of the sound after fading it out over the time argument in milliseconds. The Sound will fade and stop on all actively playing channels.


get_length()
 get the length of the Sound get_length() -> seconds  Return the length of this Sound in seconds.


get_num_channels()
 count how many times this Sound is playing get_num_channels() -> count  Return the number of active channels this sound is playing on.


get_raw()
 return a bytestring copy of the Sound samples. get_raw() -> bytes  Return a copy of the Sound object buffer as a bytes (for Python 3.x) or str (for Python 2.x) object.  New in pygame 1.9.2.


get_volume()
 get the playback volume get_volume() -> value  Return a value from 0.0 to 1.0 representing the volume for this Sound.


play()
 begin sound playback play(loops=0, maxtime=0, fade_ms=0) -> Channel  Begin playback of the Sound (i.e., on the computer's speakers) on an available Channel. This will forcibly select a Channel, so playback may cut off a currently playing sound if necessary. The loops argument controls how many times the sample will be repeated after being played the first time. A value of 5 means that the sound will be played once, then repeated five times, and so is played a total of six times. The default value (zero) means the Sound is not repeated, and so is only played once. If loops is set to -1 the Sound will loop indefinitely (though you can still call stop() to stop it). The maxtime argument can be used to stop playback after a given number of milliseconds. The fade_ms argument will make the sound start playing at 0 volume and fade up to full volume over the time given. The sample may end before the fade-in is complete. This returns the Channel object for the channel that was selected.


set_volume()
 set the playback volume for this Sound set_volume(value) -> None  This will set the playback volume (loudness) for this Sound. This will immediately affect the Sound if it is playing. It will also affect any future playback of this Sound.
Parameters:

value (float) -- volume in the range of 0.0 to 1.0 (inclusive)  If value < 0.0, the volume will not be changed If value > 1.0, the volume will be set to 1.0


stop()
 stop sound playback stop() -> None  This will stop the playback of this Sound on any active Channels.


pygame.mixer.stop()
 stop playback of all sound channels stop() -> None  This will stop all playback of all active mixer channels.


pygame.mixer.unpause()
 resume paused playback of sound channels unpause() -> None  This will resume all active sound channels after they have been paused.


pygame.mouse

 pygame module to work with the mouse  The mouse functions can be used to get the current state of the mouse device. These functions can also alter the system cursor for the mouse. When the display mode is set, the event queue will start receiving mouse events. The mouse buttons generate pygame.MOUSEBUTTONDOWN and pygame.MOUSEBUTTONUP events when they are pressed and released. These events contain a button attribute representing which button was pressed. The mouse wheel will generate pygame.MOUSEBUTTONDOWN and pygame.MOUSEBUTTONUP events when rolled. The button will be set to 4 when the wheel is rolled up, and to button 5 when the wheel is rolled down. Whenever the mouse is moved it generates a pygame.MOUSEMOTION event. The mouse movement is broken into small and accurate motion events. As the mouse is moving many motion events will be placed on the queue. Mouse motion events that are not properly cleaned from the event queue are the primary reason the event queue fills up. If the mouse cursor is hidden, and input is grabbed to the current display the mouse will enter a virtual input mode, where the relative movements of the mouse will never be stopped by the borders of the screen. See the functions pygame.mouse.set_visible() and pygame.event.set_grab() to get this configured. Mouse Wheel Behavior in pygame 2 There is proper functionality for mouse wheel behaviour with pygame 2 supporting pygame.MOUSEWHEEL events. The new events support horizontal and vertical scroll movements, with signed integer values representing the amount scrolled (x and y), as well as flipped direction (the set positive and negative values for each axis is flipped). Read more about SDL2 input-related changes here https://wiki.libsdl.org/MigrationGuide#Input In pygame 2, the mouse wheel functionality can be used by listening for the pygame.MOUSEWHEEL type of an event. When this event is triggered, a developer can access the appropriate Event object with pygame.event.get(). The object can be used to access data about the mouse scroll, such as which (it will tell you what exact mouse device trigger the event).  Code example of mouse scroll (tested on 2.0.0.dev7)
# Taken from husano896's PR thread (slightly modified)
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((640, 480))
clock = pygame.time.Clock()

def main():
   while True:
      for event in pygame.event.get():
            if event.type == QUIT:
               pygame.quit()
               return
            elif event.type == MOUSEWHEEL:
               print(event)
               print(event.x, event.y)
               print(event.flipped)
               print(event.which)
               # can access properties with
               # proper notation(ex: event.y)
      clock.tick(60)

# Execute game:
main()
     pygame.mouse.get_pressed()
 get the state of the mouse buttons get_pressed(num_buttons=3) -> (button1, button2, button3) get_pressed(num_buttons=5) -> (button1, button2, button3, button4, button5)  Returns a sequence of booleans representing the state of all the mouse buttons. A true value means the mouse is currently being pressed at the time of the call. Note, to get all of the mouse events it is better to use either pygame.event.wait() or pygame.event.get() and check all of those events to see if they are MOUSEBUTTONDOWN, MOUSEBUTTONUP, or MOUSEMOTION. Note, that on X11 some X servers use middle button emulation. When you click both buttons 1 and 3 at the same time a 2 button event can be emitted. Note, remember to call pygame.event.get() before this function. Otherwise it will not work as expected. To support five button mice, an optional parameter num_buttons has been added in pygame 2. When this is set to 5, button4 and button5 are added to the returned tuple. Only 3 and 5 are valid values for this parameter.  Changed in pygame 2.0.0: num_buttons argument added
   pygame.mouse.get_pos()
 get the mouse cursor position get_pos() -> (x, y)  Returns the x and y position of the mouse cursor. The position is relative to the top-left corner of the display. The cursor position can be located outside of the display window, but is always constrained to the screen.
   pygame.mouse.get_rel()
 get the amount of mouse movement get_rel() -> (x, y)  Returns the amount of movement in x and y since the previous call to this function. The relative movement of the mouse cursor is constrained to the edges of the screen, but see the virtual input mouse mode for a way around this. Virtual input mode is described at the top of the page.
   pygame.mouse.set_pos()
 set the mouse cursor position set_pos([x, y]) -> None  Set the current mouse position to arguments given. If the mouse cursor is visible it will jump to the new coordinates. Moving the mouse will generate a new pygame.MOUSEMOTION event.
   pygame.mouse.set_visible()
 hide or show the mouse cursor set_visible(bool) -> bool  If the bool argument is true, the mouse cursor will be visible. This will return the previous visible state of the cursor.
   pygame.mouse.get_visible()
 get the current visibility state of the mouse cursor get_visible() -> bool  Get the current visibility state of the mouse cursor. True if the mouse is visible, False otherwise.  New in pygame 2.0.0.
   pygame.mouse.get_focused()
 check if the display is receiving mouse input get_focused() -> bool  Returns true when pygame is receiving mouse input events (or, in windowing terminology, is "active" or has the "focus"). This method is most useful when working in a window. By contrast, in full-screen mode, this method always returns true. Note: under MS Windows, the window that has the mouse focus also has the keyboard focus. But under X-Windows, one window can receive mouse events and another receive keyboard events. pygame.mouse.get_focused() indicates whether the pygame window receives mouse events.
   pygame.mouse.set_cursor()
 set the image for the mouse cursor set_cursor(size, hotspot, xormasks, andmasks) -> None  When the mouse cursor is visible, it will be displayed as a black and white bitmap using the given bitmask arrays. The size is a sequence containing the cursor width and height. hotspot is a sequence containing the cursor hotspot position. A cursor has a width and height, but a mouse position is represented by a set of point coordinates. So the value passed into the cursor hotspot variable helps pygame to actually determine at what exact point the cursor is at. xormasks is a sequence of bytes containing the cursor xor data masks. Lastly andmasks, a sequence of bytes containing the cursor bitmask data. To create these variables, we can make use of the pygame.cursors.compile() function. Width and height must be a multiple of 8, and the mask arrays must be the correct size for the given width and height. Otherwise an exception is raised. See the pygame.cursor module for help creating default and custom masks for the mouse cursor and also for more examples related to cursors.
   pygame.mouse.set_system_cursor()
 set the mouse cursor to a system variant set_system_cursor(constant) -> None  When the mouse cursor is visible, it will displayed as a operating system specific variant of the options below. Pygame Cursor Constant           Description
--------------------------------------------
pygame.SYSTEM_CURSOR_ARROW       arrow
pygame.SYSTEM_CURSOR_IBEAM       i-beam
pygame.SYSTEM_CURSOR_WAIT        wait
pygame.SYSTEM_CURSOR_CROSSHAIR   crosshair
pygame.SYSTEM_CURSOR_WAITARROW   small wait cursor
                                 (or wait if not available)
pygame.SYSTEM_CURSOR_SIZENWSE    double arrow pointing
                                 northwest and southeast
pygame.SYSTEM_CURSOR_SIZENESW    double arrow pointing
                                 northeast and southwest
pygame.SYSTEM_CURSOR_SIZEWE      double arrow pointing
                                 west and east
pygame.SYSTEM_CURSOR_SIZENS      double arrow pointing
                                 north and south
pygame.SYSTEM_CURSOR_SIZEALL     four pointed arrow pointing
                                 north, south, east, and west
pygame.SYSTEM_CURSOR_NO          slashed circle or crossbones
pygame.SYSTEM_CURSOR_HAND        hand  New in pygame 2.0.0.
   pygame.mouse.get_cursor()
 get the image of the mouse cursor get_cursor() -> (size, hotspot, xormasks, andmasks)  Get the information about the mouse system cursor. The return value is the same data as the arguments passed into pygame.mouse.set_cursor().  Note This method is unavailable with pygame 2, as SDL2 does not provide the underlying code to implement this method.


pygame.pixelcopy

 pygame module for general pixel array copying  The pygame.pixelcopy module contains functions for copying between surfaces and objects exporting an array structure interface. It is a backend for pygame.surfarray, adding NumPy support. But pixelcopy is more general, and intended for direct use. The array struct interface exposes an array's data in a standard way. It was introduced in NumPy. In Python 2.7 and above it is replaced by the new buffer protocol, though the buffer protocol is still a work in progress. The array struct interface, on the other hand, is stable and works with earlier Python versions. So for now the array struct interface is the predominate way pygame handles array introspection. New in pygame 1.9.2.   pygame.pixelcopy.surface_to_array()
 copy surface pixels to an array object surface_to_array(array, surface, kind='P', opaque=255, clear=0) -> None  The surface_to_array function copies pixels from a Surface object to a 2D or 3D array. Depending on argument kind and the target array dimension, a copy may be raw pixel value, RGB, a color component slice, or colorkey alpha transparency value. Recognized kind values are the single character codes 'P', 'R', 'G', 'B', 'A', and 'C'. Kind codes are case insensitive, so 'p' is equivalent to 'P'. The first two dimensions of the target must be the surface size (w, h). The default 'P' kind code does a direct raw integer pixel (mapped) value copy to a 2D array and a 'RGB' pixel component (unmapped) copy to a 3D array having shape (w, h, 3). For an 8 bit colormap surface this means the table index is copied to a 2D array, not the table value itself. A 2D array's item size must be at least as large as the surface's pixel byte size. The item size of a 3D array must be at least one byte. For the 'R', 'G', 'B', and 'A' copy kinds a single color component of the unmapped surface pixels are copied to the target 2D array. For kind 'A' and surfaces with source alpha (the surface was created with the SRCALPHA flag), has a colorkey (set with Surface.set_colorkey()), or has a blanket alpha (set with Surface.set_alpha()) then the alpha values are those expected for a SDL surface. If a surface has no explicit alpha value, then the target array is filled with the value of the optional opaque surface_to_array argument (default 255: not transparent). Copy kind 'C' is a special case for alpha copy of a source surface with colorkey. Unlike the 'A' color component copy, the clear argument value is used for colorkey matches, opaque otherwise. By default, a match has alpha 0 (totally transparent), while everything else is alpha 255 (totally opaque). It is a more general implementation of pygame.surfarray.array_colorkey(). Specific to surface_to_array, a ValueError is raised for target arrays with incorrect shape or item size. A TypeError is raised for an incorrect kind code. Surface specific problems, such as locking, raise a pygame.error.
   pygame.pixelcopy.array_to_surface()
 copy an array object to a surface array_to_surface(<surface>, <array>) -> None  See pygame.surfarray.blit_array().
   pygame.pixelcopy.map_array()
 copy an array to another array, using surface format map_array(<array>, <array>, <surface>) -> None  Map an array of color element values - (w, h, ..., 3) - to an array of pixels - (w, h) according to the format of <surface>.
   pygame.pixelcopy.make_surface()
 Copy an array to a new surface pygame.pixelcopy.make_surface(array) -> Surface  Create a new Surface that best resembles the data and format of the array. The array can be 2D or 3D with any sized integer values.


pygame

 the top level pygame package  The pygame package represents the top-level package for others to use. Pygame itself is broken into many submodules, but this does not affect programs that use pygame. As a convenience, most of the top-level variables in pygame have been placed inside a module named pygame.locals. This is meant to be used with from pygame.locals import *, in addition to import pygame. When you import pygame all available pygame submodules are automatically imported. Be aware that some of the pygame modules are considered optional, and may not be available. In that case, pygame will provide a placeholder object instead of the module, which can be used to test for availability.   pygame.init()
 initialize all imported pygame modules init() -> (numpass, numfail)  Initialize all imported pygame modules. No exceptions will be raised if a module fails, but the total number if successful and failed inits will be returned as a tuple. You can always initialize individual modules manually, but pygame.init() is a convenient way to get everything started. The init() functions for individual modules will raise exceptions when they fail. You may want to initialize the different modules separately to speed up your program or to not use modules your game does not require. It is safe to call this init() more than once as repeated calls will have no effect. This is true even if you have pygame.quit() all the modules.
   pygame.quit()
 uninitialize all pygame modules quit() -> None  Uninitialize all pygame modules that have previously been initialized. When the Python interpreter shuts down, this method is called regardless, so your program should not need it, except when it wants to terminate its pygame resources and continue. It is safe to call this function more than once as repeated calls have no effect.  Note Calling pygame.quit() will not exit your program. Consider letting your program end in the same way a normal Python program will end.
   pygame.get_init()
 returns True if pygame is currently initialized get_init() -> bool  Returns True if pygame is currently initialized.  New in pygame 1.9.5.
   exception pygame.error
 standard pygame exception raise pygame.error(message)  This exception is raised whenever a pygame or SDL operation fails. You can catch any anticipated problems and deal with the error. The exception is always raised with a descriptive message about the problem. Derived from the RuntimeError exception, which can also be used to catch these raised errors.
   pygame.get_error()
 get the current error message get_error() -> errorstr  SDL maintains an internal error message. This message will usually be given to you when pygame.error() is raised, so this function will rarely be needed.
   pygame.set_error()
 set the current error message set_error(error_msg) -> None  SDL maintains an internal error message. This message will usually be given to you when pygame.error() is raised, so this function will rarely be needed.
   pygame.get_sdl_version()
 get the version number of SDL get_sdl_version() -> major, minor, patch  Returns the three version numbers of the SDL library. This version is built at compile time. It can be used to detect which features may or may not be available through pygame.  New in pygame 1.7.0.
   pygame.get_sdl_byteorder()
 get the byte order of SDL get_sdl_byteorder() -> int  Returns the byte order of the SDL library. It returns 1234 for little endian byte order and 4321 for big endian byte order.  New in pygame 1.8.
   pygame.register_quit()
 register a function to be called when pygame quits register_quit(callable) -> None  When pygame.quit() is called, all registered quit functions are called. Pygame modules do this automatically when they are initializing, so this function will rarely be needed.
   pygame.encode_string()
 Encode a Unicode or bytes object encode_string([obj [, encoding [, errors [, etype]]]]) -> bytes or None  obj: If Unicode, encode; if bytes, return unaltered; if anything else, return None; if not given, raise SyntaxError. encoding (string): If present, encoding to use. The default is 'unicode_escape'. errors (string): If given, how to handle unencodable characters. The default is 'backslashreplace'. etype (exception type): If given, the exception type to raise for an encoding error. The default is UnicodeEncodeError, as returned by PyUnicode_AsEncodedString(). For the default encoding and errors values there should be no encoding errors. This function is used in encoding file paths. Keyword arguments are supported.  New in pygame 1.9.2: (primarily for use in unit tests)
   pygame.encode_file_path()
 Encode a Unicode or bytes object as a file system path encode_file_path([obj [, etype]]) -> bytes or None  obj: If Unicode, encode; if bytes, return unaltered; if anything else, return None; if not given, raise SyntaxError. etype (exception type): If given, the exception type to raise for an encoding error. The default is UnicodeEncodeError, as returned by PyUnicode_AsEncodedString(). This function is used to encode file paths in pygame. Encoding is to the codec as returned by sys.getfilesystemencoding(). Keyword arguments are supported.  New in pygame 1.9.2: (primarily for use in unit tests)

   pygame.version

 small module containing version information  This module is automatically imported into the pygame package and can be used to check which version of pygame has been imported.   pygame.version.ver
 version number as a string ver = '1.2'  This is the version represented as a string. It can contain a micro release number as well, e.g. '1.5.2'
   pygame.version.vernum
 tupled integers of the version vernum = (1, 5, 3)  This version information can easily be compared with other version numbers of the same format. An example of checking pygame version numbers would look like this: if pygame.version.vernum < (1, 5):
    print('Warning, older version of pygame (%s)' %  pygame.version.ver)
    disable_advanced_features = True  New in pygame 1.9.6: Attributes major, minor, and patch.  vernum.major == vernum[0]
vernum.minor == vernum[1]
vernum.patch == vernum[2]  Changed in pygame 1.9.6: str(pygame.version.vernum) returns a string like "2.0.0" instead of "(2, 0, 0)".   Changed in pygame 1.9.6: repr(pygame.version.vernum) returns a string like "PygameVersion(major=2, minor=0, patch=0)" instead of "(2, 0, 0)".
   pygame.version.rev
 repository revision of the build rev = 'a6f89747b551+'  The Mercurial node identifier of the repository checkout from which this package was built. If the identifier ends with a plus sign '+' then the package contains uncommitted changes. Please include this revision number in bug reports, especially for non-release pygame builds. Important note: pygame development has moved to github, this variable is obsolete now. As soon as development shifted to github, this variable started returning an empty string "". It has always been returning an empty string since v1.9.5.  Changed in pygame 1.9.5: Always returns an empty string "".
   pygame.version.SDL
 tupled integers of the SDL library version SDL = '(2, 0, 12)'  This is the SDL library version represented as an extended tuple. It also has attributes 'major', 'minor' & 'patch' that can be accessed like this: >>> pygame.version.SDL.major
2 printing the whole thing returns a string like this: >>> pygame.version.SDL
SDLVersion(major=2, minor=0, patch=12)  New in pygame 2.0.0.
 Setting Environment Variables Some aspects of pygame's behaviour can be controlled by setting environment variables, they cover a wide range of the library's functionality. Some of the variables are from pygame itself, while others come from the underlying C SDL library that pygame uses. In python, environment variables are usually set in code like this: import os
os.environ['NAME_OF_ENVIRONMENT_VARIABLE'] = 'value_to_set' Or to preserve users ability to override the variable: import os
os.environ['ENV_VAR'] = os.environ.get('ENV_VAR', 'value') If the variable is more useful for users of an app to set than the developer then they can set it like this: Windows: set NAME_OF_ENVIRONMENT_VARIABLE=value_to_set
python my_application.py Linux/Mac: ENV_VAR=value python my_application.py For some variables they need to be set before initialising pygame, some must be set before even importing pygame, and others can simply be set right before the area of code they control is run. Below is a list of environment variables, their settable values, and a brief description of what they do.    Pygame Environment Variables These variables are defined by pygame itself.    PYGAME_DISPLAY - Experimental (subject to change)
Set index of the display to use, "0" is the default. This sets the display where pygame will open its window or screen. The value set here will be used if set before calling pygame.display.set_mode(), and as long as no 'display' parameter is passed into pygame.display.set_mode().    PYGAME_FORCE_SCALE -
Set to "photo" or "default". This forces set_mode() to use the SCALED display mode and, if "photo" is set, makes the scaling use the slowest, but highest quality anisotropic scaling algorithm, if it is available. Must be set before calling pygame.display.set_mode().    PYGAME_BLEND_ALPHA_SDL2 - New in pygame 2.0.0
Set to "1" to enable the SDL2 blitter. This makes pygame use the SDL2 blitter for all alpha blending. The SDL2 blitter is sometimes faster than the default blitter but uses a different formula so the final colours may differ. Must be set before pygame.init() is called.    PYGAME_HIDE_SUPPORT_PROMPT -
Set to "1" to hide the prompt. This stops the welcome message popping up in the console that tells you which version of python, pygame & SDL you are using. Must be set before importing pygame.    PYGAME_FREETYPE -
Set to "1" to enable. This switches the pygame.font module to a pure freetype implementation that bypasses SDL_ttf. See the font module for why you might want to do this. Must be set before importing pygame.    PYGAME_CAMERA -
Set to "opencv" or "vidcapture" Forces the library backend used in the camera module, overriding the platform defaults. Must be set before calling pygame.camera.init().     SDL Environment Variables These variables are defined by SDL. For documentation on the environment variables available in pygame 1 try here. For Pygame 2, some selected environment variables are listed below.    SDL_VIDEO_CENTERED -
Set to "1" to enable centering the window. This will make the pygame window open in the centre of the display. Must be set before calling pygame.display.set_mode().    SDL_VIDEO_WINDOW_POS -
Set to "x,y" to position the top left corner of the window. This allows control over the placement of the pygame window within the display. Must be set before calling pygame.display.set_mode().    SDL_VIDEODRIVER -
Set to "drivername" to change the video driver used. On some platforms there are multiple video drivers available and this allows users to pick between them. More information is available here. Must be set before calling pygame.init() or pygame.display.init().    SDL_AUDIODRIVER -
Set to "drivername" to change the audio driver used. On some platforms there are multiple audio drivers available and this allows users to pick between them. More information is available here. Must be set before calling pygame.init() or pygame.mixer.init().    SDL_VIDEO_ALLOW_SCREENSAVER
Set to "1" to allow screensavers while pygame apps are running. By default pygame apps disable screensavers while they are running. Setting this environment variable allows users or developers to change that and make screensavers run again.    SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
Set to "0" to re-enable the compositor. By default SDL tries to disable the X11 compositor for all pygame apps. This is usually a good thing as it's faster, however if you have an app which doesn't update every frame and are using linux you may want to disable this bypass. The bypass has reported problems on KDE linux. This variable is only used on x11/linux platforms.


pygame.scrap

 pygame module for clipboard support.  EXPERIMENTAL!: This API may change or disappear in later pygame releases. If you use this, your code may break with the next pygame release. The scrap module is for transferring data to/from the clipboard. This allows for cutting and pasting data between pygame and other applications. Some basic data (MIME) types are defined and registered: pygame         string
constant        value        description
--------------------------------------------------
SCRAP_TEXT   "text/plain"    plain text
SCRAP_BMP    "image/bmp"     BMP encoded image data
SCRAP_PBM    "image/pbm"     PBM encoded image data
SCRAP_PPM    "image/ppm"     PPM encoded image data pygame.SCRAP_PPM, pygame.SCRAP_PBM and pygame.SCRAP_BMP are suitable for surface buffers to be shared with other applications. pygame.SCRAP_TEXT is an alias for the plain text clipboard type. Depending on the platform, additional types are automatically registered when data is placed into the clipboard to guarantee a consistent sharing behaviour with other applications. The following listed types can be used as strings to be passed to the respective pygame.scrap module functions. For Windows platforms, these additional types are supported automatically and resolve to their internal definitions: "text/plain;charset=utf-8"   UTF-8 encoded text
"audio/wav"                  WAV encoded audio
"image/tiff"                 TIFF encoded image data For X11 platforms, these additional types are supported automatically and resolve to their internal definitions: "text/plain;charset=utf-8"   UTF-8 encoded text
"UTF8_STRING"                UTF-8 encoded text
"COMPOUND_TEXT"              COMPOUND text User defined types can be used, but the data might not be accessible by other applications unless they know what data type to look for. Example: Data placed into the clipboard by pygame.scrap.put("my_data_type", byte_data) can only be accessed by applications which query the clipboard for the "my_data_type" data type. For an example of how the scrap module works refer to the examples page (pygame.examples.scrap_clipboard.main()) or the code directly in GitHub (pygame/examples/scrap_clipboard.py).  New in pygame 1.8.   Note The scrap module is currently only supported for Windows, X11 and Mac OS X. On Mac OS X only text works at the moment - other types may be supported in future releases.    pygame.scrap.init()
 Initializes the scrap module. init() -> None  Initialize the scrap module.
Raises:

pygame.error -- if unable to initialize scrap module        Note The scrap module requires pygame.display.set_mode() be called before being initialized.
   pygame.scrap.get_init()
 Returns True if the scrap module is currently initialized. get_init() -> bool  Gets the scrap module's initialization state.
Returns:

True if the pygame.scrap module is currently initialized, False otherwise
Return type:
bool     New in pygame 1.9.5.
   pygame.scrap.get()
 Gets the data for the specified type from the clipboard. get(type) -> bytes or str or None  Retrieves the data for the specified type from the clipboard. In python 3 the data is returned as a byte string and might need further processing (such as decoding to Unicode).
Parameters:

type (string) -- data type to retrieve from the clipboard
Returns:
data (byte string in python 3 or str in python 2) for the given type identifier or None if no data for the given type is available
Return type:
bytes or str or None    text = pygame.scrap.get(pygame.SCRAP_TEXT)
if text:
    print("There is text in the clipboard.")
else:
    print("There does not seem to be text in the clipboard.")
   pygame.scrap.get_types()
 Gets a list of the available clipboard types. get_types() -> list  Gets a list of data type string identifiers for the data currently available on the clipboard. Each identifier can be used in the pygame.scrap.get() method to get the clipboard content of the specific type.
Returns:
list of strings of the available clipboard data types, if there is no data in the clipboard an empty list is returned
Return type:
list    for t in pygame.scrap.get_types():
    if "text" in t:
        # There is some content with the word "text" in its type string.
        print(pygame.scrap.get(t))
   pygame.scrap.put()
 Places data into the clipboard. put(type, data) -> None  Places data for a given clipboard type into the clipboard. The data must be a string buffer. The type is a string identifying the type of data to be placed into the clipboard. This can be one of the predefined pygame.SCRAP_PBM, pygame.SCRAP_PPM, pygame.SCRAP_BMP or pygame.SCRAP_TEXT values or a user defined string identifier.
Parameters:

type (string) -- type identifier of the data to be placed into the clipboard
data (bytes or str) -- data to be place into the clipboard (in python 3 data is a byte string and in python 2 data is a str)
Raises:

pygame.error -- if unable to put the data into the clipboard     with open("example.bmp", "rb") as fp:
    pygame.scrap.put(pygame.SCRAP_BMP, fp.read())
# The image data is now on the clipboard for other applications to access
# it.
pygame.scrap.put(pygame.SCRAP_TEXT, b"A text to copy")
pygame.scrap.put("Plain text", b"Data for user defined type 'Plain text'")
   pygame.scrap.contains()
 Checks whether data for a given type is available in the clipboard. contains(type) -> bool  Checks whether data for the given type is currently available in the clipboard.
Parameters:

type (string) -- data type to check availability of
Returns:

True if data for the passed type is available in the clipboard, False otherwise
Return type:
bool    if pygame.scrap.contains(pygame.SCRAP_TEXT):
    print("There is text in the clipboard.")
if pygame.scrap.contains("own_data_type"):
    print("There is stuff in the clipboard.")
   pygame.scrap.lost()
 Indicates if the clipboard ownership has been lost by the pygame application. lost() -> bool  Indicates if the clipboard ownership has been lost by the pygame application.
Returns:

True, if the clipboard ownership has been lost by the pygame application, False if the pygame application still owns the clipboard
Return type:
bool    if pygame.scrap.lost():
    print("The clipboard is in use by another application.")
   pygame.scrap.set_mode()
 Sets the clipboard access mode. set_mode(mode) -> None  Sets the access mode for the clipboard. This is only of interest for X11 environments where clipboard modes pygame.SCRAP_SELECTION (for mouse selections) and pygame.SCRAP_CLIPBOARD (for the clipboard) are available. Setting the mode to pygame.SCRAP_SELECTION in other environments will not change the mode from pygame.SCRAP_CLIPBOARD.
Parameters:

mode -- access mode, supported values are pygame.SCRAP_CLIPBOARD and pygame.SCRAP_SELECTION (pygame.SCRAP_SELECTION only has an effect when used on X11 platforms)
Raises:

ValueError -- if the mode parameter is not pygame.SCRAP_CLIPBOARD or pygame.SCRAP_SELECTION


pygame.sndarray

 pygame module for accessing sound sample data  Functions to convert between NumPy arrays and Sound objects. This module will only be available when pygame can use the external NumPy package. Sound data is made of thousands of samples per second, and each sample is the amplitude of the wave at a particular moment in time. For example, in 22-kHz format, element number 5 of the array is the amplitude of the wave after 5/22000 seconds. Each sample is an 8-bit or 16-bit integer, depending on the data format. A stereo sound file has two values per sample, while a mono sound file only has one.   pygame.sndarray.array()
 copy Sound samples into an array array(Sound) -> array  Creates a new array for the sound data and copies the samples. The array will always be in the format returned from pygame.mixer.get_init().
   pygame.sndarray.samples()
 reference Sound samples into an array samples(Sound) -> array  Creates a new array that directly references the samples in a Sound object. Modifying the array will change the Sound. The array will always be in the format returned from pygame.mixer.get_init().
   pygame.sndarray.make_sound()
 convert an array into a Sound object make_sound(array) -> Sound  Create a new playable Sound object from an array. The mixer module must be initialized and the array format must be similar to the mixer audio format.
   pygame.sndarray.use_arraytype()
 Sets the array system to be used for sound arrays use_arraytype (arraytype) -> None  DEPRECATED: Uses the requested array type for the module functions. The only supported arraytype is 'numpy'. Other values will raise ValueError.
   pygame.sndarray.get_arraytype()
 Gets the currently active array type. get_arraytype () -> str  DEPRECATED: Returns the currently active array type. This will be a value of the get_arraytypes() tuple and indicates which type of array module is used for the array creation.  New in pygame 1.8.
   pygame.sndarray.get_arraytypes()
 Gets the array system types currently supported. get_arraytypes () -> tuple  DEPRECATED: Checks, which array systems are available and returns them as a tuple of strings. The values of the tuple can be used directly in the pygame.sndarray.use_arraytype() () method. If no supported array system could be found, None will be returned.  New in pygame 1.8.