I have a matplotlib widget Textbox as follows
temp_descr = \'wow\'
self.axLabel = plt.axes([0.7, 0.05, 0.21, 0.075])
self.text_boxLabel = TextBox(self.axLabel, \
You do not only want to set the text which is shown but also change the text which is internally stored. To do this all at once use the TextBox
's .set_val()
method.
import matplotlib.pyplot as plt
import matplotlib.widgets
temp_descr = 'wow'
axLabel = plt.axes([0.7, 0.05, 0.21, 0.075])
textbox = matplotlib.widgets.TextBox(axLabel, 'Label: ', temp_descr)
textbox.set_val("jojojo")
plt.show()
In case anyone is wondering how to do it the "wrong" way, here it is:
textbox.text = "foo, bar and baz"
This will update the display without updating the internal state, which could be useful to mock the "initial" functionality. Just beware that it will introduce some hard to find inconsistencies.