2014-02-11 127 views
0

如何删除警告如从控制台以下警告:从控制台中删除警告

QObject::startTimer: QTimer can only be used with threads started with QThread 
QObject::startTimer: QTimer can only be used with threads started with QThread 
QObject::startTimer: QTimer can only be used with threads started with QThread 

更新:这只是一个猜测,它提出,因为我使用ElementTree的解析XML文档转换成一个元素树:

def parse(source, parser=None): 
    tree = ElementTree() 
    tree.parse(source, parser) 
    return tree 

,如果你指导我,我可以使用它以外的ElementTree其他解析器我将不胜感激..

+1

你的意思是一般情况下,还是只是QObject相关的警告? – BlackVegetable

+1

@RaydelMiranda这是来自Qt的警告消息,如果出现错误,它会在_runtime_中发布。 –

+0

当我关闭Qwidget窗口时,它显示在我的控制台中。是的,我的意思是如何从控制台解决此特定警告。 –

回答

2

这不是一个警告,这是一个错误,你应该ñ ot“删除它”,你应该修复它。 发生这种情况是因为您从QThread中未启动的线程使用QObject。可能你正在使用本地python线程。改用QThread,你会没事的。 XML的东西是一个红色的鲱鱼,似乎不相关。