How to set text color using pyKDE 0.8?
Henning Schroeder
hschroeder at gmx.net
Fri Jul 30 05:58:49 EDT 1999
More information about the Python-list mailing list
Fri Jul 30 05:58:49 EDT 1999
- Previous message (by thread): Python and SlickEdit
- Next message (by thread): How to set text color using pyKDE 0.8?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Peter Torstenson <p.t at iname.com> wrote: > I'm using pyKDE 0.8 binding for python. > I made a QLabel on the main widget. Now I'd like to change the color of the > text inside this QLabel. > I managed to change the backgroundcolor and the font. But I can't find any > info on how to change the color of the text, or the foregroundcolor. This is a little bit tricky. Every widget has a palette() function which returns a QPalette. This palette consists of three color-groups which can be accessed through normal(), disabled() and disabled() and can be changed trought its corresponding set-functions (setNormal(), ...). According to the state of the widget one of these color-groups is shown. You can find more about setting up color-groups in the QT docs (e.g qcolorgroup.html). Hope that helps Henning ---------------------------- #!/usr/bin/python from kde import * import sys app = QApplication(sys.argv) label = QLabel("Hello world!") pal = label.palette() pal.setNormal(QColorGroup(red, green, blue, black, gray, yellow, white)) label.setPalette(QPalette(pal)) label.show() app.setMainWidget(label) app.exec_loop() ----------------------------
- Previous message (by thread): Python and SlickEdit
- Next message (by thread): How to set text color using pyKDE 0.8?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list