AttributeError:对象...没有属性

时间:2020-08-24 23:58:23

标签: python c++ attributes python-c-api

我的fb.h文件中有这个文件:

static fbClass *getInstance();
void clearFBblit();
int getFBdiff(int ret);
void setFBdiff(int top, int right, int left, int bottom);

和我的fb.cpp内容:

void fbClass::clearFBblit()
{
    //set real frambuffer transparent
//  memset(lfb, 0x00, xRes * yRes * 4);
    blit();
}

int fbClass::getFBdiff(int ret)
{
    if(ret == 0)
        return topDiff;
    else if(ret == 1)
        return leftDiff;
    else if(ret == 2)
        return rightDiff;
    else if(ret == 3)
        return bottomDiff;
    else
        return -1;
}

void fbClass::setFBdiff(int top, int left, int right, int bottom)
{
    if(top < 0) top = 0;
    if(top > yRes) top = yRes;
    topDiff = top;
    if(left < 0) left = 0;
    if(left > xRes) left = xRes;
    leftDiff = left;
    if(right > 0) right = 0;
    if(-right > xRes) right = -xRes;
    rightDiff = right;
    if(bottom > 0) bottom = 0;
    if(-bottom > yRes) bottom = -yRes;
    bottomDiff = bottom;
}

在另一个文件中,我使用了以下代码:

def yellow(self):
    global top
    global right
    global bottom
    global left
    print '[OSD Adjustment] set Default Screen Settings'
    top = 0
    bottom = 0
    left = 0
    right = 0
    fbClass.getInstance().setFBdiff(0, 0, 0, 0)
    fbClass.getInstance().clearFBblit()

现在,当我运行我的代码时,我得到了:

fbClass.getInstance()。setFBdiff(0,0,0,0) AttributeError:“ fbClass”对象没有属性“ setFBdiff”

我犯什么错误?

0 个答案:

没有答案