Hi,

I'm confused  about setting the background color on a textview.
I've googled, but the answers seem to not work, or I didn't understand them properly.

I have a scrolled window with a text view inside, and using pango markup.

I have tried

       view1 = gtk.TextView();
view1.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("papaya whip") ) #have tried plain names such as red, green blue

       sw = gtk.ScrolledWindow()
       sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
       sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
sw.add(view1)
No change to the background.

I notice that scrolledWindow does not receive x events, and seen comments that you need an eventbox so can change background, ... but does that also apply to textview when it's embedded in the ScrolledWindow?, do I need to but the scrolled window into a eventbox so the textview can get the event?

I looked at pango, and from what I can understand I can successfully set the paragraphs background color, ... but not the whole TextView?, also the margins are still white, and that looks kind of ugly.

       table = textbuf.get_tag_table()
       tag = gtk.TextTag('marketspeak')
       tag.set_property( 'weight', pango.WEIGHT_BOLD)
       tag.set_property( 'foreground', "black")
       tag.set_property( 'paragraph-background', "papaya whip") #"yellow")
       tag.set_property( 'left_margin', 10)
       tag.set_property( 'right_margin', 10)
       table.add(tag)


Can someone steer me in the right direction.
If it matters I am on Windows 2K.

Thanks
Steve
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to