最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Python中运行graphics图形库,结果出错:Runtime Error! R6025 pure virtual function call

Python crifan 8044浏览 0评论

【问题】

在折腾:

【记录】尝试Python的图形库:graphics

的过程中,

XP + Python 3.2.2

在cmd中运行python脚本,代码如下:

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
Function:
【记录】尝试Python的图形库:graphics
https://www.crifan.com/try_with_python_gui_lib_graphics

Author:     Crifan
Verison:    2012-11-30
-------------------------------------------------------------------------------
"""

from graphics import *;

def graphicsDemo():
    """Demo Python 3.x graphics lib
    """
    
    win = GraphWin();
    pt = Point(100, 50);
    pt.draw(win);
    
    cir = Circle(pt, 25);
    cir.draw(win);
    
###############################################################################
if __name__=="__main__":
    graphicsDemo();

结果运行出错:

Runtime Error!

Program: xxx\Python32\python.exe

R6025

– pure virtual function call

R6025 pure virtual function call

点击确定后,结果还会有错误:

Graphics Window: python.exe – 应用程序错误

应用程序发生异常 unknown software exception (0x40000015),位置为 0x67341027.

要终止程序,请单击“确定”。

 

unkown software exception 0x40000015

 

【解决过程】

1.网上找了很多帖子,结果都还是不知道如何解决。

2.参考:

Pure virtual function call errors and related behavior News and other things I find interesting

好像解释了根本原因,但是也还是不会解决此问题。

只是隐约的了解到,估计还是有些python函数不兼容,或者实现的有问题,而导致此错误的。

3.后来实在这条路走不通了。

然后回去参考:

Graphics

去找找,其所说的graphIntroSteps.py,到底是个什么东西。

然后就搜到了:

http://anh.cs.luc.edu/python/hands-on/3.1/examples/

对应的文件:

http://anh.cs.luc.edu/python/hands-on/3.1/examples/graphIntroSteps.py

此处,感觉有眉目了。

估计就是上面

http://anh.cs.luc.edu/python/hands-on/3.1/examples/

中所缺少的一堆文件,导致此处对应的调用到的函数找不到,即类似于虚函数调用了,但是却没找到对应的函数,而报此处的错误的。

4.然后就是想办法下载这么一堆文件。

进入到上一级目录:

http://anh.cs.luc.edu/python/hands-on/3.1/

找到了:

Graphics相关的一套文件:

http://anh.cs.luc.edu/python/hands-on/3.1/examples.zip

然后下载下来。

至此,才明白,原来最开始的:

Graphics

中所说的的那个“examples folder”就指的是,这么一堆文件,解压后的相关的文件夹和文件。

包括graphics.py和graphIntroSteps.py。

5.解压后,先试试,把自己的python文件graphics_demo.py,移到examples文件夹内,然后再去执行看看结果。

结果还是上述同样的pure virtual function call错误。

6.后续证明,此处的Python 3.x的graphics库,是无法在windows的cmd中运行的。

只能按照官网的教程:

Graphics

去通过graphics提供的IDLE,比如examples文件夹内的快捷方式IdlePython32Shortcut去运行IDLE(即那个Python Shell),才可以正常运行的。

 

【总结】

此处,问题比较特殊,不是常见的缺少虚函数的实现,而导致的此种R6025 pure virtual function call。

所以,还是要具体问题具体分析才可以的。

转载请注明:在路上 » 【已解决】Python中运行graphics图形库,结果出错:Runtime Error! R6025 pure virtual function call

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

  1. 我也遇到类似的问题。不过我把360关了就没问题了。。。。
    Hope11年前 (2013-02-22)回复
88 queries in 0.170 seconds, using 22.15MB memory