Pygame2 for Pygamers

This section is about migrating from Pygame to Pygame2 and explains the smaller and bigger changes, which you will encounter, if you are already used to Pygame.

Module Names and Packages

In Pygame2, the whole module and package layout changed. While Pygame used a ‘get all from module pygame‘ approach, Pygame2 forces you to explicitly import the required bits and pieces.

While in Pygame, you simply do a

import pygame # Import anything

in Pygame2 you have to

import pygame2           # Import the Pygame2 core
import pygame2.sdl       # Import the SDL core wrapper
import pygame2.sdl.video # Import the SDL video system
import pygame2.sdlmixer  # Import the SDL_mixer wrapper
...

Each Pygame2 package and module forces you to explicitly import it. While this sounds like a lot of typing work all over the place, it also lets you easily choose and deploy only the minimum of the required dependencies for your application and keeps your imports free of superfluous stuff.

Initialization and Shutdown

Similar to the explicit imports, you also have to explicitly initialize the modules, where necessary. In Pygame, a

pygame.init ()
...
pygame.quit ()

is enough to initialize nearly all parts and shut them down at the end of the program. In Pygame2, you have to explicitly initialize the modules (not all of them, of course. Only the majority of the SDL-related ones and pygame2.freetype).

pygame2.sdl.video.init ()
pygame2.sdl.audio.init ()
pygame2.sdlmixer.init ()
...
pygame2.sdl.video.quit ()
pygame2.sdl.audio.quit ()
pygame2.sdlmixer.quit ()

Note

The pygame2.sdl modules can also be initialized using pygame2.sdl.init() and the appropriate flags.

Some modules might contain an init() and quit() method, which do not use anything (such as e.g. pygame2.openal). Those are mostly for future usage and might be required to be invoked in later version of Pygame2.

Detail Changes (or: where to find what)

The following subsections will provide you a comparision of which Pygame module, class, method or function can be found where in Pygame2 now.

pygame

pygame.init
There is no similar function or attribute in Pygame2. Use the corresponding init() functions of the modules and packages.
pygame.quit
There is no similar function or attribute in Pygame2. Use the corresponding quit() functions of the modules and packages.
pygame.error
pygame2.Error
pygame.get_error
pygame2.sdl.get_error(), pygame2.sdlmixer.get_error(), ...
pygame.set_error
There is no similar function or attribute in Pygame2.
pygame.get_sdl_version
pygame2.sdl.get_version() and pygame2.sdl.get_compiled_version()
pygame.get_sdl_byteorder
pygame2.sdl.constants.BYTEORDER
pygame.register_quit
There is no similar function or attribute in Pygame2.
pygame.version
pygame2.version_info and pygame2.__version__

pygame.camera

The module is not (yet) ported to Pygame2.

pygame.cdrom

pygame.cdrom
pygame2.sdl.cdrom
pygame.cdrom.init
pygame2.sdl.cdrom.init()
pygame.cdrom.quit
pygame2.sdl.cdrom.quit()
pygame.cdrom.get_init
pygame2.sdl.cdrom.was_init()
pygame.cdrom.get_count
pygame2.sdl.cdrom.num_drives()
pygame.cdrom
pygame2.sdl.cdrom
pygame.cdrom.CD
pygame2.sdl.cdrom.CD
pygame.cdrom.CD.init
pygame2.sdl.cdrom.CD.open()
pygame.cdrom.CD.quit
pygame2.sdl.cdrom.CD.close()
pygame.cdrom.CD.get_init
There is no similar function or attribute in Pygame2.
pygame.cdrom.CD.play
pygame2.sdl.cdrom.CD.play() and pygame2.sdl.cdrom.CD.play_tracks()
pygame.cdrom.CD.stop
pygame2.sdl.cdrom.CD.stop()
pygame.cdrom.CD.pause
pygame2.sdl.cdrom.CD.pause()
pygame.cdrom.CD.resume
pygame2.sdl.cdrom.CD.resume()
pygame.cdrom.CD.eject
pygame2.sdl.cdrom.CD.eject()
pygame.cdrom.CD.get_id
pygame2.sdl.cdrom.CD.index
pygame.cdrom.CD.get_name
pygame2.sdl.cdrom.CD.name
pygame.cdrom.CD.get_busy
pygame2.sdl.cdrom.CD.status == pygame2.sdl.constants.CD_PLAYING
pygame.cdrom.CD.get_paused
pygame2.sdl.cdrom.CD.status == pygame2.sdl.constants.CD_PAUSED
pygame.cdrom.CD.get_current

pygame2.sdl.cdrom.CD.cur_track and pygame2.sdl.cdrom.CD.cur_frame

pygame2.sdl.cdrom.CD.cur_track will return a pygame2.sdl.cdrom.CDTrack object with additional information about the track length, type, etc.

pygame.cdrom.CD.get_empty
pygame2.sdl.cdrom.CD.status == pygame2.sdl.constants.CD_TRAYEMPTY
pygame.cdrom.CD.get_numtracks
pygame2.sdl.cdrom.CD.num_tracks
pygame.cdrom.CD.get_track_audio
pygame2.sdl.cdrom.CDTrack.type == pygame2.sdl.constants.AUDIO_TRACK
pygame.cdrom.CD.get_all

pygame2.sdl.cdrom.CD.tracks

pygame2.sdl.cdrom.CD.tracks returns a list of pygame2.sdl.cdrom.CDTrack object, which provide additional information about the tracks.

pygame.cdrom.CD.get_track_start

pygame2.sdl.cdrom.CDTrack.offset

pygame2.sdl.cdrom.CDTrack.offset will return the track offset in frames.

pygame.cdrom.CD.get_track_length
pygame2.sdl.cdrom.CDTrack.length

pygame.Color

No notable changes apply here, except that there is no replacement for pygame.Color.set_length().

pygame.cursors

pygame.cursors can be found under pygame2.sdl.cursors.

pygame.display

pygame.display

There is no 1:1 replacement for pygame.display.

Instead you have to use a mixture of pygame2.sdl.video, pygame2.sdl.wm and pygame2.sdl.gl

pygame.display.init
pygame2.sdl.video.init()
pygame.display.quit
pygame2.sdl.video.quit()
pygame.display.get_init
pygame2.sdl.video.was_init()
pygame.display.set_mode
pygame2.sdl.video.set_mode()
pygame.display.get_surface
pygame2.sdl.video.get_videosurface()
pygame.display.flip
Use pygame2.sdl.video.Surface.flip() of the video surface.
pygame.display.update
Use pygame2.sdl.video.Surface.update() of the video surface.
pygame.display.get_driver
pygame2.sdl.video.get_drivername()
pygame.display.Info
pygame2.sdl.video.get_info()
pygame.display.get_wm_info
pygame2.sdl.wm.get_info()
pygame.display.list_modes
pygame2.sdl.video.list_modes()
pygame.display.mode_ok
pygame2.sdl.video.is_mode_ok()
pygame.display.gl_get_attribute
pygame2.sdl.gl.get_attribute()
pygame.display.gl_set_attribute
pygame2.sdl.gl.set_attribute()
pygame.display.get_active

pygame2.sdl.event.get_app_state()

(pygame2.sdl.event.get_app_state () & pygame2.sdl.constants.APPACTIVE) == pygame2.sdl.constants.APPACTIVE
pygame.display.iconify
pygame2.sdl.wm.iconify_window()
pygame.display.toggle_fullscreen
pygame2.sdl.wm.toggle_fullscreen()
pygame.display.set_gamma
pygame2.sdl.video.set_gamma()
pygame.display.set_icon
pygame2.sdl.wm.set_icon()
pygame.display.set_caption
pygame2.sdl.wm.set_caption()
pygame.display.get_caption
pygame2.sdl.wm.get_caption()
pygame.display.set_palette
Use pygame2.sdl.video.Surface.set_palette() of the video surface.

pygame.draw

pygame.draw can be found under pygame2.sdlext.draw.

pygame.event

pygame.event
pygame2.sdl.event
pygame.event.pump
pygame2.sdl.event.pump()
pygame.event.get
pygame2.sdl.event.get()
pygame.event.poll
pygame2.sdl.event.poll()
pygame.event.wait
pygame2.sdl.event.wait()
pygame.event.peek
pygame2.sdl.event.peek()
pygame.event.clear
pygame2.sdl.event.clear()
pygame.event.event_name
pygame2.sdl.event.Event.name
pygame.event.set_blocked
pygame2.sdl.event.set_blocked()
pygame.event.set_allowed
Use pygame2.sdl.event.state() with pygame2.sdl.constants.ENABLE
pygame.event.get_blocked
pygame2.sdl.event.get_blocked()
pygame.event.set_grab
pygame2.sdl.wm.grab_input()
pygame.event.get_grab

pygame2.sdl.event.get_app_state()

(pygame2.sdl.event.get_app_state () & (pygame2.sdl.constants.APPMOUSEFOCUS | pygame2.sdl.constants.APPINPUTFOCUS) ==
  (pygame2.sdl.constants.APPMOUSEFOCUS | pygame2.sdl.constants.APPINPUTFOCUS)
pygame.event.post
pygame2.sdl.event.push()
pygame.event.Event
pygame2.sdl.event.Event

pygame.font

pygame.font separates into two different modules in Pygame2, pygame2.font for font-file related tasks and pygame2.sdlttf for the SDL_ttf wrapper.

pygame.font.init
pygame2.sdlttf.init()
pygame.font.quit
pygame2.sdlttf.quit()
pygame.font.get_init
pygame2.sdlttf.was_init()
pygame.font.init
pygame2.sdlttf.init()
pygame.font.get_default_font
There is no similar function or attribute in Pygame2.
pygame.font.get_fonts
There is no similar function or attribute in Pygame2.
pygame.font.match_font
pygame2.font.find_font()
pygame.font.SysFont
pygame2.sdlttf.sysfont.get_sys_font()
pygame.font.Font
pygame2.sdlttf.Font
pygame.font.Font.render
pygame2.sdlttf.Font.render()
pygame.font.Font.size
pygame2.sdlttf.Font.get_size()
pygame.font.Font.set_underline
pygame2.sdlttf.Font.style |= pygame2.sdlttf.constants.STYLE_UNDERLINE
pygame.font.Font.get_underline

pygame2.sdlttf.Font.style

(pygame2.sdlttf.Font.style & pygame2.sdlttf.constants.STYLE_UNDERLINE) ==
   pygame2.sdlttf.constants.STYLE_UNDERLINE
pygame.font.Font.set_bold
pygame2.sdlttf.Font.style |= pygame2.sdlttf.constants.STYLE_BOLD
pygame.font.Font.get_bold

pygame2.sdlttf.Font.style

(pygame2.sdlttf.Font.style & pygame2.sdlttf.constants.STYLE_BOLD) ==
   pygame2.sdlttf.constants.STYLE_BOLD`
pygame.font.Font.set_italic
pygame2.sdlttf.Font.style |= pygame2.sdlttf.constants.STYLE_ITALIC
pygame.font.Font.get_italic

pygame2.sdlttf.Font.style

(pygame2.sdlttf.Font.style & pygame2.sdlttf.constants.STYLE_ITALIC) ==
   pygame2.sdlttf.constants.STYLE_ITALIC
pygame.font.Font.metrics
pygame2.sdlttf.Font.get_glyph_metrics()
pygame.font.Font.get_linesize
pygame2.sdlttf.Font.line_skip
pygame.font.Font.get_height
pygame2.sdlttf.Font.height
pygame.font.Font.get_ascent
pygame2.sdlttf.Font.ascent
pygame.font.Font.get_descent
pygame2.sdlttf.Font.descent

pygame.gfxdraw

pygame.gfxdraw can be found under pygame2.sdlgfx.

pygame.image

pygame.image separates into two different modules in Pygame2, pygame2.sdl.image for BMP loading and pygame2.sdlimage for the SDL_image wrapper.

pygame.image.load
pygame2.sdl.image.load_bmp() and pygame2.sdlimage.load()
pygame.image.save
pygame2.sdl.image.save_bmp() and pygame2.sdl.video.Surface.save()
pygame.image.get_extended
There is no similar function or attribute in Pygame2. If the pygame2.sdlimage module is available and pygame2.sdl.video is built with PNG and JPEG support, you can assume to have extended format support for loading and saving images.
pygame.image.tostring
Use the pygame2.sdl.video.Surface.pixels attribute.
pygame.image.fromstring
There is no similar function or attribute in Pygame2. Use the pygame2.sdl.video.Surface.pixels attribute to access the raw buffer.
pygame.image.frombuffer
There is no similar function or attribute in Pygame2. Use the pygame2.sdl.video.Surface.pixels attribute to access the raw buffer.

pygame.joystick

pygame.joystick
pygame2.sdl.joystick
pygame.joystick.init
pygame2.sdl.joystick.init()
pygame.joystick.quit
pygame2.sdl.joystick.quit()
pygame.joystick.get_init
pygame2.sdl.joystick.was_init()
pygame.joystick.get_count
pygame2.sdl.joystick.num_joysticks()
pygame.joystick.Joystick
pygame2.sdl.joystick.Joystick
pygame.joystick.Joystick.init
pygame2.sdl.joystick.Joystick.open()
pygame.joystick.Joystick.quit
pygame2.sdl.joystick.Joystick.close()
pygame.joystick.Joystick.get_init
pygame2.sdl.joystick.Joystick.opened
pygame.joystick.Joystick.get_id
pygame2.sdl.joystick.Joystick.index
pygame.joystick.Joystick.get_name
pygame2.sdl.joystick.Joystick.name
pygame.joystick.Joystick.get_numaxes
pygame2.sdl.joystick.Joystick.num_axes
pygame.joystick.Joystick.get_axis
pygame2.sdl.joystick.Joystick.get_axis
pygame.joystick.Joystick.get_numballs
pygame2.sdl.joystick.Joystick.num_balls
pygame.joystick.Joystick.get_ball
pygame2.sdl.joystick.Joystick.get_ball()
pygame.joystick.Joystick.get_numbuttons
pygame2.sdl.joystick.Joystick.num_buttons
pygame.joystick.Joystick.get_button
pygame2.sdl.joystick.Joystick.get_button()
pygame.joystick.Joystick.get_numhats
pygame2.sdl.joystick.Joystick.num_hats
pygame.joystick.Joystick.get_hat
pygame2.sdl.joystick.Joystick.get_hat()

pygame.key

pygame.key
pygame2.sdl.keyboard
pygame.key.get_focused

pygame2.sdl.event.get_app_state()

(pygame2.sdl.event.get_app_state () & (pygame2.sdl.constants.APPINPUTFOCUS) == pygame2.sdl.constants.APPINPUTFOCUS
pygame.key.get_pressed
pygame2.sdl.keyboard.get_state()
pygame.key.get_mods
pygame2.sdl.keyboard.get_mod_state()
pygame.key.set_mods
pygame2.sdl.keyboard.set_mod_state()
pygame.key.set_repeat
pygame2.sdl.keyboard.enable_repeat()
pygame.key.get_repeat
pygame2.sdl.keyboard.get_repeat()
pygame.key.name
pygame2.sdl.keyboard.get_key_name()

pygame.locals

Constants are put into the corresponding constants module of the package, they belong to, e.g. pygame2.sdl.constants, pygame2.sdlttf.constants, etc.

pygame.mask

pygame.mask can be found under pygame2.mask.

pygame.midi

pygame.midi can be found under pygame2.midi.

pygame.mixer

pygame.mixer.music is handled by the pygame2.sdlmixer.Music class within the pygame2.sdlmixer module.

pygame.mixer
pygame2.sdlmixer
pygame.mixer.init
pygame2.sdlmixer.init() and pygame2.sdlmixer.open_audio()
pygame.mixer.pre_init
pygame2.sdlmixer.open_audio()
pygame.mixer.quit
pygame2.sdlmixer.quit() and pygame2.sdlmixer.close_audio()
pygame.mixer.get_init
pygame2.sdlmixer.was_init()
pygame.mixer.stop
Use pygame2.sdlmixer.Channel.halt() or pygame2.sdlmixer.channel.halt().
pygame.mixer.pause
Use pygame2.sdlmixer.Channel.pause() or pygame2.sdlmixer.channel.pause().
pygame.mixer.unpause
Use pygame2.sdlmixer.Channel.resume() or pygame2.sdlmixer.channel.resume().
pygame.mixer.fadeout
Use pygame2.sdlmixer.Channel.fade_out() or pygame2.sdlmixer.channel.fade_out().
pygame.mixer.set_num_channels
There is no similar function or attribute in Pygame2. Use pygame2.sdlmixer.open_audio().
pygame.mixer.get_num_channels
There is no similar function or attribute in Pygame2.
pygame.mixer.set_reserved
There is no similar function or attribute in Pygame2.
pygame.mixer.find_channel
There is no similar function or attribute in Pygame2.
pygame.mixer.get_busy
There is no similar function or attribute in Pygame2.
pygame.mixer.Sound
pygame2.sdlmixer.Sound and pygame2.sdlmixer.Chunk
pygame.mixer.Sound.play
There is no similar function or attribute in Pygame2. Use pygame2.sdlmixer.Channel.play().
pygame.mixer.Sound.stop
There is no similar function or attribute in Pygame2. Use pygame2.sdlmixer.Channel.halt().
pygame.mixer.Sound.fadeout
There is no similar function or attribute in Pygame2. Use pygame2.sdlmixer.Channel.fade_out().
pygame.mixer.Sound.set_volume
pygame2.sdlmixer.Chunk.volume
pygame.mixer.Sound.get_volume
pygame2.sdlmixer.Chunk.volume
pygame.mixer.Sound.get_num_channels
There is no similar function or attribute in Pygame2.
pygame.mixer.Sound.get_length
pygame2.sdlmixer.Chunk.len
pygame.mixer.Sound.get_buffer
pygame2.sdlmixer.Chunk.buf
pygame.mixer.Channel
pygame2.sdlmixer.Channel
pygame.mixer.Channel.play
pygame2.sdlmixer.Channel.play()
pygame.mixer.Channel.stop
pygame2.sdlmixer.Channel.halt()
pygame.mixer.Channel.pause
pygame2.sdlmixer.Channel.pause()
pygame.mixer.Channel.unpause
pygame2.sdlmixer.Channel.resume()
pygame.mixer.Channel.fadeout
pygame2.sdlmixer.Channel.fade_out()
pygame.mixer.Channel.set_volume
pygame2.sdlmixer.Channel.volume
pygame.mixer.Channel.get_volume
pygame2.sdlmixer.Channel.volume
pygame.mixer.Channel.get_busy
pygame2.sdlmixer.Channel.playing and pygame2.sdlmixer.Channel.paused and pygame2.sdlmixer.Channel.fading
pygame.mixer.Channel.get_sound
pygame2.sdlmixer.Channel.chunk
pygame.mixer.Channel.queue
There is no similar function or attribute in Pygame2.
pygame.mixer.Channel.get_queue
There is no similar function or attribute in Pygame2.
pygame.mixer.Channel.set_endevent
There is no similar function or attribute in Pygame2.
pygame.mixer.Channel.get_endevent
There is no similar function or attribute in Pygame2.

pygame.mixer.music

pygame.mixer.music
pygame2.sdlmixer.music
pygame.mixer.music.load
Instantiate a pygame2.sdlmixer.Music object.
pygame.mixer.music.play
pygame2.sdlmixer.Music.play()
pygame.mixer.music.rewind
pygame2.sdlmixer.music.rewind()
pygame.mixer.music.stop
pygame2.sdlmixer.music.halt()
pygame.mixer.music.pause
pygame2.sdlmixer.music.pause()
pygame.mixer.music.unpause
pygame2.sdlmixer.music.resume()
pygame.mixer.music.fadeout
pygame2.sdlmixer.music.fade_out()
pygame.mixer.music.set_volume
pygame2.sdlmixer.music.set_volume()
pygame.mixer.music.get_volume
pygame2.sdlmixer.music.get_volume()
pygame.mixer.music.get_busy
pygame2.sdlmixer.music.playing() and pygame2.sdlmixer.music.fading() pygame2.sdlmixer.music.paused()
pygame.mixer.music.get_pos
There is no similar function or attribute in Pygame2.
pygame.mixer.music.queue
There is no similar function or attribute in Pygame2.
pygame.mixer.music.set_endevent
There is no similar function or attribute in Pygame2.
pygame.mixer.music.get_endevent
There is no similar function or attribute in Pygame2.

pygame.mouse

pygame.mouse
pygame2.sdl.mouse
pygame.mouse.get_pressed
pygame2.sdl.mouse.get_state()
pygame.mouse.get_pos
pygame2.sdl.mouse.get_position()
pygame.mouse.get_rel
pygame2.sdl.mouse.get_rel_position()
pygame.mouse.set_pos
pygame2.sdl.mouse.set_position() and pygame2.sdl.mouse.warp()
pygame.mouse.set_visible
pygame2.sdl.mouse.set_visible() and pygame2.sdl.mouse.show_cursor()
pygame.mouse.get_focused

pygame2.sdl.event.get_app_state()

(pygame2.sdl.event.get_app_state () & (pygame2.sdl.constants.APPMOUSEFOCUS) == pygame2.sdl.constants.APPMOUSEFOCUS
pygame.mouse.set_cursor
pygame2.sdl.mouse.set_cursor()
pygame.mouse.get_cursor
There is no similar function or attribute in Pygame2.

pygame.movie

The module is not (yet) ported to Pygame2.

pygame.Overlay

pygame.Overlay
pygame2.sdl.video.Overlay
pygame.Overlay.display
pygame2.sdl.video.Overlay.display()
pygame.Overlay.set_location
There is no similar function or attribute in Pygame2.
pygame.Overlay.get_hardware
pygame2.sdl.video.Overlay.hw_overlay

pygame.PixelArray

pygame.PixelArray can be found under pygame2.sdlext.PixelArray.

pygame.Rect

No notable changes apply here.

pygame.scrap

pygame.scrap can be found under pygame2.sdlext.scrap.

pygame.sndarray

pygame.sndarray can be found under pygame2.sdlmixer.sndarray.

pygame.sprite

No notable changes apply here.

pygame.surfarray

pygame.surfarray can be found under pygame2.sdlext.surfarray.

pygame.Surface

pygame.Surface
pygame2.sdl.video.Surface
pygame.Surface.
pygame2.sdl.video.Surface.blit()
pygame.Surface.convert
pygame2.sdl.video.Surface.convert()
pygame.Surface.convert_alpha
pygame2.sdl.video.Surface.convert()
pygame.Surface.copy
pygame2.sdl.video.Surface.copy()
pygame.Surface.fill
pygame2.sdl.video.Surface.fill()
pygame.Surface.scroll
pygame2.sdl.video.Surface.scroll()
pygame.Surface.set_colorkey
pygame2.sdl.video.Surface.set_colorkey()
pygame.Surface.get_colorkey
pygame2.sdl.video.Surface.get_colorkey()
pygame.Surface.set_alpha
pygame2.sdl.video.Surface.set_alpha()
pygame.Surface.get_alpha
pygame2.sdl.video.Surface.get_alpha()
pygame.Surface.lock
pygame2.sdl.video.Surface.lock()
pygame.Surface.unlock
pygame2.sdl.video.Surface.unlock()
pygame.Surface.mustlock
There is no similar function or attribute in Pygame2.
pygame.Surface.get_locked
pygame2.sdl.video.Surface.locked
pygame.Surface.get_locks
There is no similar function or attribute in Pygame2.
pygame.Surface.get_at
pygame2.sdl.video.Surface.get_at()
pygame.Surface.set_at
pygame2.sdl.video.Surface.set_at()
pygame.Surface.get_palette
pygame2.sdl.video.Surface.get_palette()
pygame.Surface.get_palette_at
There is no similar function or attribute in Pygame2.
pygame.Surface.set_palette
pygame2.sdl.video.Surface.set_palette()
pygame.Surface.set_palette_at
There is no similar function or attribute in Pygame2.
pygame.Surface.map_rgb
pygame2.sdl.video.PixelFormat.map_rgba() of pygame2.sdl.video.Surface.format
pygame.Surface.unmap_rgb
pygame2.sdl.video.PixelFormat.get_rgba() of pygame2.sdl.video.Surface.format
pygame.Surface.set_clip
pygame2.sdl.video.Surface.clip_rect
pygame.Surface.get_clip
pygame2.sdl.video.Surface.clip_rect
pygame.Surface.subsurface
There is no similar function or attribute in Pygame2.
pygame.Surface.get_parent
There is no similar function or attribute in Pygame2.
pygame.Surface.get_abs_parent
There is no similar function or attribute in Pygame2.
pygame.Surface.get_size
pygame2.sdl.video.Surface.size
pygame.Surface.get_width
pygame2.sdl.video.Surface.width or pygame2.sdl.video.Surface.w
pygame.Surface.get_height
pygame2.sdl.video.Surface.height or pygame2.sdl.video.Surface.h
pygame.Surface.get_rect
There is no similar function or attribute in Pygame2.
pygame.Surface.get_bitsize
pygame2.sdl.video.PixelFormat.bits_per_pixel of pygame2.sdl.video.Surface.format
pygame.Surface.get_bytesize
pygame2.sdl.video.PixelFormat.bytes_per_pixel of pygame2.sdl.video.Surface.format
pygame.Surface.get_flags
pygame2.sdl.video.Surface.flags
pygame.Surface.get_pitch
pygame2.sdl.video.Surface.pitch
pygame.Surface.get_masks
pygame2.sdl.video.PixelFormat.masks of pygame2.sdl.video.Surface.format
pygame.Surface.set_masks
There is no similar function or attribute in Pygame2.
pygame.Surface.get_shifts
pygame2.sdl.video.PixelFormat.shifts of pygame2.sdl.video.Surface.format
pygame.Surface.set_shifts
There is no similar function or attribute in Pygame2.
pygame.Surface.get_losses
pygame2.sdl.video.PixelFormat.losses of pygame2.sdl.video.Surface.format
pygame.Surface.get_bounding_rect
There is no similar function or attribute in Pygame2.
pygame.Surface.get_buffer
pygame2.sdl.video.Surface.pixels

pygame.time

pygame.time
pygame2.sdl.time
pygame.time.get_ticks
pygame2.sdl.time.get_ticks()
pygame.time.wait
pygame2.sdl.time.delay()
pygame.time.delay
pygame2.sdl.time.delay()
pygame.time.set_timer
Use pygame2.sdl.time.add_timer()
pygame.time.Clock
There is no similar class in Pygame2.