| FAQ Index - Search - Recent Changes - Everything - Add entry |
10.18. Changing a Window's background color
Thanks to Gian Mario Tagliaretti on the PyGTK mailing list:
import pygtk
pygtk.require('2.0')
import gtk
class FirstWin:
def __init__(self):
self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
color = gtk.gdk.color_parse('#234fdb')
self.win.modify_bg(gtk.STATE_NORMAL, color)
# To change the color again, just modify it again
self.win.show()
def main(self):
gtk.main()
if __name__ == "__main__":
first = FirstWin()
first.main()
