首页 > 解决方案 > 如何将“get (gcf, 'currentchar') ~= ' '” 从 Matlab 转换为 Python?

问题描述

我正在尝试将 Matlab 程序转换为 Python。这是 Matlab 代码的开头:

while get(gcf, 'currentchar') ~= ' '
    if get(gcf,'currentchar')=='r'

我已经看到我需要导入我所做的 matplotlib.pyplot,但我未能在 Python 中找到与 Matlab 'currentchar' 等效的东西。“获取”部分也是如此。我猜Matlab程序的目标是检测打开当前图形时使用了哪个键并采取相应的行动(当使用一个键时,如果使用的键是“r”,那么做[...])

你知道如何翻译这个吗?

标签: pythonmatlab

解决方案


推荐阅读