[PyKDE] .. a bit of progress ...

Dave S eric3 at pusspaws.net
Sat Sep 16 10:22:15 BST 2006


On Friday 15 September 2006 22:19, Dave S wrote:
> Hi all,
>
> I need to add a large company logo as the backdrop to my QTable. Googling I
> managed to work out that I need something like ...
>
> m = QImage(file ??)
> self.table1.setPaletteBackgroundPixmap(Qpixmap(m.scale(max W, max H,
> Qimage.ScaleMax))
>
> My problem - how do I get a file into QImage ? The only examples I have
> found have large ascii files embedded into the python script eg ..
>
> image0_data = \
>     "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \
>     "\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40" \
> ...
>
> I can open my jpeg with standard python but am stuck on how to get it into
> QImage.
>
> Any suggestions
>
> Dave
>
> (PS My app looks so cool - love QT)


A bit of progress but still stuck ...
        
        backgnd_png = self.config.get('files','background') 
        print backgnd_png
        image = QImage.load(backgnd_png)
        self.table1.setPaletteBackgroundPixmap(QPixmap(image.scale(1000, 1000, 
QImage.ScaleMax)))

gives ...

dave at dave-comp:~/my_files/python_develop/unison/PxQxAudit/app$ ./view.py
/home/ubuntu/python_develop/unison/PxQxAudit/lib/backgnd.png
Traceback (most recent call last):
  File "./view.py", line 332, in ?
    main(sys.argv)
  File "./view.py", line 323, in main
    docview = View()
  File "./view.py", line 76, in __init__
    image = QImage.load(backgnd_png)
TypeError: first argument of unbound method QImage.load() must be a QImage 
instance
dave at dave-comp:~/my_files/python_develop/unison/PxQxAudit/app$


Dave





>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde




More information about the PyQt mailing list