The code looks all right to me... what exactly do you mean, "it didn't work"? Did it raise an error? Did it not do what you expected/wanted? Did Pythonista crash? When something doesn't work like it should, please give enough details so we can understand what you are trying to do and what exactly goes wrong.
Anyway, I think I can imagine what you are thinking what the program does. I'll go over the draw method in a little detail:
background(0.00, 0.00, 0.00)
fill(1.00,1.00,1.00)
background(0.00, 0.00, 0.00)
fill(1.00,1.00,1.00)
The background function clears the scene and fills it with a single color, in this case black. fill sets the color used when drawing shapes (rectangles, ellipses), but doesn't do anything immediately. (There's no need to call these functions twice, because you're just repeating what you did before.)
g = gravity()
self.x += g.x * 10
self.y += g.y * 10
self.x = min(self.size.w - 100, max(0, self.x))
self.y = min(self.size.h - 100, max(0, self.y))
These statements get the device rotation, do some math and bounds checking and move self.x and self.y, which are later used when drawing the shapes.
ellipse(self.x,self.y,100,100)
rect(self.x,self.y,100,100)
Here's where your problem is (probably). ellipse draws an ellipsis (in this case a circle) with the given coordinates and size. rect does the same, but draws a rectangle (in this case a square). Because both the circle and the square are drawn in exactly the same spot, the square hides the circle.
Even when swapping these two statements so the circle is drawn second, you'll still only see a white square - remember that at the beginning the fill color is set to white, this applies to both the square and the circle. If you want to use different colors for the two shapes, you need to call fill again in between.
Here's a modified version of the draw method, which draws the circle on top of the square and using a different color. Look at the differences between the two versions and you'll probably understand what's going on.
def draw(self):
background(0.0, 0.0, 0.0)
g = gravity()
self.x += g.x * 10
self.y += g.y * 10
self.x = min(self.size.w - 100, max(0, self.x))
self.y = min(self.size.h - 100, max(0, self.y))
fill(1.0, 0.0, 0.0)
rect(self.x, self.y, 100, 100)
fill(0.0, 0.0, 1.0)
ellipse(self.x, self.y, 100, 100)