Unable to call Squish functions in Python modules

34 Views Asked by At

Problem: Unable to call squish functions in Python modules. Imported squish & added squish. in front of its function but doesn't seem to work.

test.py

import gAPI 

screenshot(obj, filename) 

gAPI.py

import squish 

def screenshot(obj, file): 
    widget = squish.waitForObject(obj) 
    img = squish.grabWidget(widget) 
    img.squish.save(file,"PNG") 
return img 

When this is ran in Python modules it returns the error "QPixmap" Squish object has no attribute "squish". Wonder if anyone knows how to resolve this.

1

There are 1 best solutions below

0
frog.ca On

As far as I can tell it should be...

img.save(file,"PNG")

...instead.

The fact that the QPixmap type is located in module "squish" does not mean that ".squish" needs to be added to calls of its methods/functions. So this works the same as for any other Python type.