【问题标题】:PyCharm show graphicsPyCharm 显示图形
【发布时间】:2014-09-21 20:54:42
【问题描述】:

我正在尝试让 PyC​​harm 显示我的图形,但是当我运行此脚本时,屏幕上什么也没有出现。

from pylab import *

def main():
    ion()
    t = arange(0.0, 2.0, 0.01)
    s = sin(2*pi*t)
    plot(t, s)

    xlabel('time (s)')
    ylabel('voltage (mV)')
    title('About as simple as it gets, folks')
    grid(True)    
    show()

我正在使用 Python 2.7.6、Pycharm 3.4 和 Windows 7 x64。


D:\Python27\python.exe "D:/sletmig/python tests/pandas/chart.py"

Process finished with exit code 0

我是 Python 新手!

【问题讨论】:

  • 你在哪里调用main函数?

标签: python windows pycharm


【解决方案1】:

将此添加到脚本的末尾:

if __name__ == "__main__":
    main()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-30
    • 2018-06-28
    • 1970-01-01
    • 2019-02-16
    • 2018-10-19
    • 2014-09-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多