Saturday, May 18, 2024
HomeCSSpython - Altering the colour of Gtk.Entry textual content

python – Altering the colour of Gtk.Entry textual content


I need to change the colour of textual content in a Gtk.Entry. With override_color deprecated, this ought to be completed utilizing CSS, nevertheless I have no idea learn how to apply it correctly. May somebody assist adapt the code beneath, such that the change_color perform modifications the colour of textual content inside self.entry?

class Entry(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self)
        self.join("destroy", Gtk.main_quit)

        self.entry = Gtk.Entry()

        self.button = Gtk.Button(label="button")
        self.button.join('clicked', self.change_color)

        field = Gtk.Field()
        field.set_orientation(Gtk.Orientation.HORIZONTAL)
        field.add(self.entry)
        field.add(self.button)

        self.add(field)

    def change_color(self, widget):
        go

window = Entry()
window.show_all()
Gtk.predominant()

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments