It will depend on how you do it. btw I don't know python so I am trying to keep my answers generic as anything specific will be in c.
Each shape should have an associated data structure. E.g. for polygonal shapes: number of vertices then an ordered array of x,y pairs describing them (you can then build on this by adding things like line/fill colour etc.). Your drawing area would then have an associated array of these structures (if you do go the custom widget path then you would add this array as a member of your widget - either publicly or privately through accessor functions).
In order to select a shape you need to determine which shape the mouse is nearest when clicked. This can also be done a variety of ways, but I would lean towards defining a centre of mass (
http://en.wikipedia.org/wiki/Centroid#Of_a_finite_set_of_points) for each polygon and doing a distance^2 check on all shapes in your array to pick the closest one. You might also want to highlight it in some way when selected (e.g. halving the alpha, bitwise negation of the colour, etc.) to indicate to the user which item they have selected. Having a drag animation could also help.
If you look around you might find some projects that can help as examples to guide you (e.g. goocanvas), though they're more likely written in c/c++.