How to color the gtk window?

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

How to color the gtk window?

Post by arivas_2005 »

I want to color the whole window ..
especially .. background color to list
with the code that I have ..

Code: Select all

#!/bin/bash

export LISTADO="UNO
DOS
TRES
CUATRO
CINCO
"

   echo 'style "blackbg" {
    font_name="DejaVu Sans 8"
     bg[NORMAL]    = "cyan"
     fg[NORMAL]  = "green"
     base[NORMAL]   = "blue"
     bg[ACTIVE] ="red"
	fg[ACTIVE]="cyan"
	fg[INSENSITIVE]	= "magenta"
	fg[PRELIGHT]	= "black" 
	text[ACTIVE]	="red"
	text[PRELIGHT]	= "gold"
	text[SELECTED]	= "brown"
	fg[PRELIGHT]	= "black"
     }
 class "*" style "blackbg"    
widget "*arboles" style "blackbg
   
   '   > /tmp/gtkrc
   export GTK2_RC_FILES=/tmp/gtkrc:/root/.gtkrc-2.0

export auto='
<window>
   <vbox>
		<text name="texto"><label>elige</label></text>
       <tree name="arboles" rules-hint="true" headers-visible="false" activates-default="true" hover-selection="true"  file-monitor="true"  reorderable="true">
		<label>LISTAOPCIONES</label>
		<variable>SELECCIONA</variable> 
		<input>echo -e "$LISTADO"</input>
      </tree>      
   </vbox>
</window>'

gtkdialog -p auto -G 110x200+20+20

the list is not colored
and
I want to put blue background and bold yellow letter (to list UNO DOS TRES CUATRO CINCO)
Thanks!

Eastler_Dart
Posts: 80
Joined: Wed Aug 05, 2020 3:34 am
Has thanked: 1 time
Been thanked: 8 times

Re: How to color the gtk window?

Post by Eastler_Dart »

copied your script, saved it, execute it,
got Error:
/tmp/gtkrc:19: error: scanner: unterminated string constant

open /tmp/gtkrc in editor, look about line 19 =
widget "*arboles" style "blackbg
there is a " missing at the end

try it, maybe it works

arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

Re: How to color the gtk window?

Post by arivas_2005 »

Thank you
I already made the correction.
After several experiments, I found that it depends on the chosen gtk-theme. This is because after I changed the theme "Fusion" to another, the coloring of the tree frame already appeared.
So the coloring of the windows .. also depends on the gtk- puppy theme

Eastler_Dart
Posts: 80
Joined: Wed Aug 05, 2020 3:34 am
Has thanked: 1 time
Been thanked: 8 times

Re: How to color the gtk window?

Post by Eastler_Dart »

yes, I think it's because you said it to puppy :-))

export GTK2_RC_FILES=/tmp/gtkrc:/root/.gtkrc-2.0
==> first theme with /tmp/gtkrc then : theme with root/.gtkrc-2.0

try to swap the both themefilenames ;

export GTK2_RC_FILES=/root/.gtkrc-2.0:/tmp/gtkrc

hope it helps

Post Reply

Return to “Programming”