Page 1 of 1

gtkdialogs and colors

Posted: Thu 25 Oct 2012, 22:13
by arivas_2005
I know very little programming

I want to learn about

in this code

Code: Select all

#! /bin/bash

export MAIN_DIALOG='
 <vbox>
   <text>
    <label>access to</label>
  </text>
  <entry>    
    <default>Default value</default>
    <variable>ENTRY</variable>
  </entry>
  <hbox>
   <button ok></button>
   <button cancel></button>
  </hbox>
 </vbox>
'

gtkdialog --program=MAIN_DIALOG
how I can put..
a) color in font: access to or Default value
b) color background in <text> and <entry>
c) alignment to center in <label>, <text> or <entry>
d) asign program1 to <button ok> and program2 to <button cancel>

I searched the internet but I'm very confused about how to use commands in gtkdialg

Thank you. though I know I ask many details, I wish I collaborate

regards

Posted: Thu 25 Oct 2012, 22:26
by puppyluvr
:D Hello,
I believe that those settings are global for gtkdialog, but dont hold me to that.. Ive done many gtkdialog programs, and never thought about colors..
I would tend to bet there is a gtk.rc type file that contains settings for default colors, fonts, etc...
Although I dont know the exact answer, I posted so I can follow this thread..because I WANT TO....
Thank you for asking... 8)

Posted: Fri 26 Oct 2012, 00:17
by seaside
arivas_2005,

To make a very ugly example, here's how to create a temporary gtkrc file to control your program colors and execute programs.

Code: Select all

#! /bin/bash

	echo 'style "blackbg" {
	 font_name="DejaVu Sans 15"
	  bg[NORMAL]    = "black"
	  fg[NORMAL]  = "green"
	  base[NORMAL]	= "yellow"
	  }
	class "*" style "blackbg"' > /tmp/gtkrc
	export GTK2_RC_FILES=/tmp/gtkrc:/root/.gtkrc-2.0

export MAIN_DIALOG='
 <vbox>
   <text>
    <label>access to</label>
  </text>
  <entry>   
    <default>Default value</default>
    <variable>ENTRY</variable>
  </entry>
  <hbox>
   <button ok><action> echo program1</action><action>EXIT:ok</action></button>
   <button cancel><action> echo program2</action><action>EXIT:cancel</action></button>
  </hbox>
 </vbox>
'

gtkdialog --program=MAIN_DIALOG 
There is a rich source of tips here-
http://murga-linux.com/puppy/viewtopic.php?t=38608

Cheers,
s