GTK+ - Labels mit schwarzem Hintergrund



  • Wie sind Labels mit schwarzem Hintergrund (oder auch andere Farben) mit der GTK+ (2.x) zu realisieren? Die Befehle
    gtk_widget_modify_bg();
    gtk_widget_modify_base();
    zeigen keine Wirkung, obwohl sich die Schriftfarbe mit
    gtk_widget_modify_fg();
    ändern lässt.

    mfg, Uli



  • Da hast du anscheinend einen Fehler in GTK entdeckt:
    das klappt auch bei mir nicht.
    Obwohl es bei mir bei anderen Widgets funktioniert mit der Hintergrundfarbe.



  • Nein es ist kein Fehler. Es würde helfen wenn ihr auch die Dokumentation dazu lest, dann würdet ihr folgendes lesen.

    Note that "no window" widgets (which have the GTK_NO_WINDOW flag set) draw on their parent container's window and thus may not draw any background themselves. This is the case for e.g. GtkLabel. To modify the background of such widgets, you have to set the background color on their parent; if you want to set the background of a rectangular area around a label, try placing the label in a GtkEventBox widget and setting the background color on that.

    Quelle: http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html

    BR


Anmelden zum Antworten