clip text with a Rectangle

I want to draw some text and have it clipped by another rectangle I draw.
The text should only display inside the box. I have some sample
code that seems like it should work, but obviously there is something wrong
because the text does not display at all. Any help?

import matplotlib.pyplot as plt

fig = plt.figure()

ax = fig.add_subplot(111)

mybar, = ax.bar(0,1)

mytext = ax.text(0.5, 0.5, ‘text inside box’)

mytext2 = ax.text(-0.3, 0.2, ‘text outside box’)

ax.set_xlim(-1.5, 2.0)

ax.set_ylim(-1.0, 2.5)

fig.canvas.draw()

comment out these lines to see text

mytext.set_clip_on(True)

mytext.set_clip_box(mybar.get_bbox())

mytext2.set_clip_on(True)

mytext2.set_clip_box(mybar.get_bbox())

plt.show()

Thanks,

-Ben