如何解决matlibplot - TextBox:如何获取输入并继续程序?
matlibplot - TextBox:如何获取输入并继续程序? 我看了这个例子: https://matplotlib.org/stable/gallery/widgets/textbox.html 当我尝试此代码时,我“卡在”窗口中,我只想给出 1 个值并继续。 像这样:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import TextBox
fig,ax = plt.subplots()
fig.subplots_adjust(bottom=0.2)
x = ''
def submit(expression):
x = expression
axbox = fig.add_axes([0.1,0.05,0.8,0.075])
text_box = TextBox(axbox,"Evaluate")
text_box.on_submit(submit)
text_box.set_val("6") # Trigger `submit` with the initial string.
plt.show()
plt.clf()
# fig.**
print(x)
print("I want to get here!")
重要 我想对下一个代码使用相同的数字,所以我不能要求用户关闭数字。 非常感谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。