Matplotlib 的 GUI 不允许在保存框中输入内容?
我已经在 python 中使用 matplotlib 一段时间了,我终于开始询问这个关于我的 mac 上的问题了。 当绘图显示时(在 plot()
命令、draw()
或 show()
之后),我拥有我想要的所有功能可能想要; 我可以移动、缩放等我在代码中没有做的事情。
当我根据需要保存带有视图的图形时,另存为框会打开并提示输入文件名。 我输入的任何内容都会出现在我用来执行命令的终端中! 选择 X11 然后键入具有相同的结果。 似乎没有任何东西可以将键盘输出放入该框中,但我可以使用鼠标->粘贴操作将其粘贴到该框中,并且我可以在菜单中选择要覆盖的文件,并且工作正常。
这是怎么回事?
更新:
这个问题得到了很好的概述,现在发布了一些解决方案 在这篇文章中:为什么保存按钮在 matplotlib 绘图上不起作用?
I've been using matplotlib in python for some time now and I've finally gotten around to asking this question about an issue on my mac. When a plot shows up (after the plot()
command, draw()
, or show()
), I have all the functionality I could want; I can move, zoom, etc. that I didn't do in the code.
When I go to save a figure with the view as I desire the save as box opens up and prompts for a filename. Anything I type appears in the terminal I used to execute the command! Selecting X11 and then typing has same result. Nothing seems to put the keyboards output into that box, but I can paste into the box using the mouse->Paste action and I can select files in the menu to overwrite and it works fine.
What's up with this?
Update:
The problem was wonderfully outlined and now has some solutions posted in this post: Why doesn't the save button work on a matplotlib plot?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
刚刚在 Snow Leopard 上的 Python 2.6.2 上安装了 matplotlib 0.99.1 并运行了以下代码:
然后,我摆弄了绘图一段时间,然后单击“保存”按钮。 保存对话框正常弹出并允许我保存(和输入)。 这是使用 TkAgg 后端。 但是,我确实收到了这个错误:
这似乎与 Snow Leopard 更改某些 API 有关。
抱歉,您将其作为帖子而不是评论来输入,但评论中不允许使用代码标签:(
Just installed matplotlib 0.99.1 on Python 2.6.2 on Snow Leopard and ran the following code:
Then, I fiddled around with the plot for a while and clicked the save button. The save dialog box popped up normally and allowed me to save (and type) fine. This was using the TkAgg backend. However, I did get this error:
Which seems to be something to do with Snow Leopard changing some APIs.
Sorry for using typing this as a post instead of a comment, but code tags aren't allowed in comments :(