[PyQt] Set a SVG image as background and with transparency

"Gustavo A. Dí­az" gustavo.diaz at gmail.com
Wed Aug 8 01:47:02 BST 2007


What i want is this: Do you ever saw an superkaramba applet? it has no
QT background and uses semi-transparents PNG pixmaps as application
background.
That is what i want.

Thanks.

Cheers.


David Boddie escribió:
> On Mon, 6 Aug 2007 11:17:18 -0300, Gustavo A. Díaz wrote:
>
>   
>> I tried to render a svg file and load as background, which i didn't
>> succeed... i just threated it as a pixmaps to load it, but with that i cant
>> set transparency ,if i am not wrong.
>>     
>
> Pixmaps can have levels of transparency, too.
>
>   
>> For example, i have a label which is the same size of my application and is
>> where i put the image as background having this result:
>>
>> http://opencoffee.lnxteam.org/downloads/pub/pics/OpenCoffee_Server.png (is
>> the mainWidget background, the bluish one)
>>     
>
> So, do you want just the blue areas to be partially transparent?
>
> I'm not sure how to do that.
>
>   
>> Now, i want to know how to load that image but rendering as a SVG file
>> should be threated in that background. What i temporary did is:
>>
>> self.mainWindowPixmap = QtGui.QPixmap (
>> ":/Pixmaps/pixmaps/oc_mainWindowBg.svg")
>> self.mainWindowBg.setPixmap(self.mainWindowPixmap)
>>
>> (mainWindowBg is the QLabel)
>>
>> Which i know is not the correct way to threat a SVG image.
>>     
>
> OK, but it's still worth testing with a pixmap - as you have done.
>
>   
>> I have two doubts here, one is i want to set transparency a SVG image,
>> render and set it in that QLabel
>> The other, is how do i set transparency for the window of that app using
>> that SVG image? (which should have transparency if i am not wrong)
>>     
>
> The transparency set using QWidget.setWindowOpacity() is for everything in
> the window, which isn't what you want. It might be worth checking that this
> works, anyway, because what you want to do will depend on system features
> that this also needs.
>
>   
>> PS: i know David, i read those links about transparency... but i have those
>> doubts and i have no clear how to render a svg file and load/set inside a
>> QLabel
>>     
>
> I would suggest using a QSvgWidget instead of a QLabel for displaying
> SVG drawings that you want to be scalable.
>
> David
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>   


-- 
/Gustavo A. Díaz/
*GDNet Projects*
www.gdnet.com.ar <http://www.gdnet.com.ar>
Gustavo A. Díaz
-------------- next part --------------
Skipped content of type multipart/related


More information about the PyQt mailing list