PyQt question (colors)

Boudewijn Rempt boud at valdyas.org
Tue Apr 9 11:29:11 EDT 2002


Janos Blazi wrote:

> If I say
> 
>     stat_lab1.setBackgroundColor(QColor("DarkGreen"))
> 
> and stat_lab is a QLabel, this has the required effect. But if I say
> 
>     pb.setBackgroundColor(QColor("DarkGreen"))
> 
> and pb is a QProgressBar object, so this has no effect at all. Can anybody
> tell me the reason for this? I use PyQt with Qt 2.3 on a MS-Win2000
> system.
> 

Using colors in Qt is quite complicated, unfortunately, and it has
become even more complicated in Qt 3, where setBackgroundColor is
so deprecated as to have disappeared from PyQt.

In this case I think you will really have to read Troll Tech's documentation 
to get a real understanding: it's not something that can be accurately
explained in a Usenet posting. The upshot is that what you perceive
to be the same thing -- the background of a label and a progressbar,
are in the Qt system of widget painting different things.

-- 
Boudewijn Rempt | http://www.valdyas.org



More information about the Python-list mailing list