更新画布上的文字wxpython

时间:2013-05-12 12:11:15

标签: python matplotlib wxpython

canvas = FigureCanvas(self, -1, fig)
canvas.mpl_connect('pick_event',on_pick)
canvas.mpl_connect('motion_notify_event', motion_notify_callback)
SSkey1=wx.StaticText(canvas,-1,"SS",pos=(623,42))
SSkey2=wx.StaticText(canvas,-1,"C-Red",pos=(603,52))

我的代码首先显示文本,但是当我调用canvas.draw()时,它会更新画布但删除文本。如何才能使文本保留在画布上?

1 个答案:

答案 0 :(得分:0)

我假设您的代码中有某个Axes对象,称之为ax

基本:

ax.text(x, y, 'test')

doc

Fancy(有更多选项(tutorial)):

ax.annotate('test', (x, y))

doc)