does this work for you? It should show a window with text on a red
background for 3 seconds.

###################
from gtk import *

window = GtkWindow()
text = GtkText()
window.add(text)

style = text.get_style()
print "before realize: colormap = ",style.colormap
window.realize()
print "after realize: colormap = ",style.colormap

red = style.colormap.alloc(0xFFFF, 0x0000, 0x0000)
text.insert(style.font,style.black,red,"Hello")

window.show_all()

import signal
signal.alarm(3)
mainloop()
####################


Sam Tannous <[EMAIL PROTECTED]> writes:

> I'm not sure if this made it out (I didn't see
> it sent out last night)...
> 
> -------------------------------------
> OK I give up.  After a few hours of twiddling
> I can't seem to figure out how to insert red
> text on a white background in a GtkText widget.
> 
> Would anyone be kind enough to supply me a few lines
> of code?  
> 
> Here's what I've tried which doesn't work:
> 
> ---------------------------------
> #       text.insert_defaults(b)
> #       font = "lucidasanstypewriter-12"
> #       realfont = load_font(font)
>         style = text.get_style()
>         print "colormap = ",style.colormap
>         red = colour_alloc("0xFFFF", "0x0000", "0x0000")
> #        style.fg =  ["0", "0xFFFF", "0x0000", "0x0000"]
> #        black = [0, 0x0000, 0x0000, 0x0000]
> #        white = [0, 0xFFFF, 0xFFFF, 0xFFFF]
> #        red = [0, 0xFFFF, 0x0000, 0x0000]  
> #        green = [0, 0x0000, 0xFFFF, 0x0000]
> #        blue = [0, 0x0000, 0x0000, 0xFFFF] 
> #        cyan = [0, 0x0000, 0xFFFF, 0xFFFF] 
> #        magenta = 0, 0xFFFF, 0x0000, 0xFFFF]
> #        yellow = [0, 0xFFFF, 0xFFFF, 0x0000]
> 
>         text.insert(style.font,style.black,red,b)
> ---------------------------------
> 
> Thanks,
> Sam "I promise to add lots of documentation when I finish" Tannous
> 
> ----- End forwarded message -----
> 
> -- 
> ===================================================
> Sam Tannous, NSA    ciscoSystems, RTP, NC
> [EMAIL PROTECTED]  919.472.2541  page:800.365.4578
> 
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to