Naomi Wang
Naomi Wang

Reputation: 1

Unable to call Squish functions in Python modules

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.

Upvotes: 0

Views: 220

Answers (1)

frog.ca
frog.ca

Reputation: 732

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.

Upvotes: 0

Related Questions