Box2D debug draw is now part of the Box2D debug overlay. master
Box2D debug draw is now part of the Box2D debug overlay.

file:a/game.py -> file:b/game.py
--- a/game.py
+++ b/game.py
@@ -22,19 +22,6 @@
         self.contactListener=b2tools.DispatchingContactListener()
 
         self.world=b2World(contactListener=self.contactListener)
-
-        # Debug draw for Box2D
-        self.debugDraw=True
-        self.debugDrawer=b2tools.DebugDraw(surface=self.screen,test=self)
-        self.debugDrawer.flags=dict(
-            drawShapes=True,
-            drawJoints=True,
-#            drawAABBs =True,
-            drawPairs =True,
-            drawCOMs  =True,
-            convertVertices=isinstance(self.debugDrawer, b2DrawExtended)
-            )
-        self.world.renderer=self.debugDrawer
 
         # Initialize the game system
         self.debugOverlay=GObjDebugOverlay(self)
@@ -54,6 +41,7 @@
                 elif event.type==pygame.KEYUP:
                     if event.key==pygame.K_F3:
                         self.debugOverlay.visible=not self.debugOverlay.visible
+                        self.debugDraw=self.debugOverlay.visible
                     else:
                         for listener in self.eventListeners:
                             listener.key_up(event)
@@ -72,10 +60,6 @@
 
             self.update()
             self.draw()
-
-            if self.debugDraw:
-                self.world.renderer.StartDraw()
-                self.world.DrawDebugData()
 
             pygame.display.flip()
 
@@ -284,7 +268,25 @@
 class DebugBox2D(DebugView):
     def __init__(self,overlay,game):
         super(DebugBox2D,self).__init__(overlay,game,(100,3*GObjDebugOverlay.letter_height))
-    def draw(self,screen):
+
+        # Debug draw for Box2D
+        self.debugDrawer=b2tools.DebugDraw(surface=game.screen,test=game)
+        self.debugDrawer.flags=dict(
+            drawShapes=True,
+            drawJoints=True,
+#            drawAABBs =True,
+            drawPairs =True,
+            drawCOMs  =True,
+            convertVertices=isinstance(self.debugDrawer, b2DrawExtended)
+            )
+        game.world.renderer=self.debugDrawer
+
+    def draw(self,screen):
+        # Shape drawing
+        self.debugDrawer.StartDraw()
+        self.game.world.DrawDebugData()
+
+        # Show statistics
         active=0
         bodies=self.game.world.bodyCount
         for body in self.game.world.bodies: