I have created a window with a background image. On top of this window I put GtkTextview, but I cannot figure out how to make the background of GtkTextview transparent. (Note: I know in general it is not good to have transparent textview because its hard to read characters. But in this project it would look very nice with the background image I have on window widget).
I would like to know if this is possible to achieve with settings styles in gtkrc ? I have investigated this, and it seems that normal gtkrc "engine" cannot do this. It doesn't support RGBA colors, only RGB. I have tried using bg_pixmap with transparent image, but it didn't work. I have read that for example "murrine" engine should support transparency in gtkrc, but I cannot find any examples how it should be used.
If it is not possible with gtkrc, I am interested to hear how I could code my own custom GtkTextview widget, which would render with transparent background. I have seen some examples where people overwrite expose_event to do their own drawing. It seems quite challenging because I am not yet very familiar with cairo.
Here is the gtkrc..
bg_pixmap[NORMAL] = "window_bg.png"
#GtkTextView::honors-transparent-bg-hint = 1
# what to put here?
bg_pixmap[NORMAL] = "textview_transparent_bg.png"
widget "*window-widget" style "window"
widget "*text-view-field" style "text-view-style"
And here is the pygtk code which creates a window and textview...
Testing how make textview transparent with gtkrc.
def cb_destroy_window(widget, data=None):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_title("Transparent textview with gtkrc")
vbox = gtk.VBox(False, 5)
text_view = gtk.TextView()
vbox.pack_start(text_view, False, False, 10)
if __name__ == "__main__":