Font size and color in gtk entry or buttons (Solved)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
arivas_2005
Posts: 212
Joined: Sun 25 Feb 2007, 14:39

Font size and color in gtk entry or buttons (Solved)

#1 Post by arivas_2005 »

regards

i have the following mini-code

Code: Select all

export A='
<window window-position="1" decorated="true" >
   <vbox>
		      <text>
					<label>Registro de Nombres </label>
			 </text>
			  <entry text="Nombres" is-focus="true" caps-lock-warning="false" xalign="1" width-chars="20" height-request="25" space-expand="true">
				 <variable>NOMBRES</variable>
				 <action signal="activate">grabfocus:APELLIDOS</action>
				 <action signal="activate">command</action>
			 </entry>
			 <entry text="Apellidos" caps-lock-warning="false" xalign="0" width-chars="20" height-request="25" space-expand="true">
				  <variable>APELLIDOS</variable>
				  <action signal="activate">grabfocus:DIRECCION</action>
				  <action signal="activate">command</action>
			 </entry>
			  <checkbox>
					<variable>SEXO</variable>
					<label>Es Masculino</label>
			</checkbox>
			 <entry text="Direccion" caps-lock-warning="false" xalign="2" width-chars="20" height-request="25" space-expand="true" activates-default="true" has-default="true">
					<variable>DIRECCION</variable>
					<action signal="activate">command</action>
			 </entry>
			 <button  use-stock="true" label="gtk-ok" can-default="true" has-default="true">
			 </button>			 
	</vbox>    		 
</window>'

gtkdialog -p A 
I need to do the following

How I can assign different font size for each entry (or check and buttons).

How I can apply different color and different font for each entry (or check and buttons).


for reading problems, I need to increase to at least 16, 20 or 24 point size.

I also need to implement easy to read font


Similarly, I need to color the box for easy filling

excuse my Inglés
thank you very much
Last edited by arivas_2005 on Mon 11 Nov 2013, 01:14, edited 1 time in total.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#2 Post by don570 »

Have you looked through this thread first?

http://murga-linux.com/puppy/viewtopic.php?t=81534


_____________________________________________________________

Also I think that Thunor wrote an example script showing fonts
perhaps in the misc folder??

http://murga-linux.com/puppy/viewtopic.php?t=82059

______________________________

arivas_2005
Posts: 212
Joined: Sun 25 Feb 2007, 14:39

#3 Post by arivas_2005 »

hi

I checked the links, but
is very complex for my level.

I found something about "styles", but
I do not know how to integrate

Example:

Code: Select all

echo 'style "specialmono"
{
  font_name="Sans 50" 
  bg[NORMAL]    = "black"
  bg[NORMAL]  = "green"
  base[NORMAL]   = "yellow"
  
}


widget "*mono" style "specialmono"
class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono

export GTK2_RC_FILES=/tmp/gtkrc_mono:/root/.gtkrc-2.0
Well .. keep waiting for a solution.

==========================================
seek, seek and not find my solution
but, in this link
http://208.109.22.214/puppy/viewtopic.p ... 84d6c5ae3f
I found something like what I need
ptiming has two large box with colored font.

I checked and the code is very complex ptiming and for me.
I am novel in programming
excuse my english. I use traslate soft.
==========================================
Thanks

arivas_2005
Posts: 212
Joined: Sun 25 Feb 2007, 14:39

#4 Post by arivas_2005 »

continuing the search for the solution

good.

After hours and hours searching ..... I found the effect he wanted in Ptiming.

After hours and hours and hours of trial and error I summarized the following code.

Code: Select all

#!/bin/sh
#Ptiming 
#Copyright 2011,2012,2013
#Sigmund Berglund - Valåmoen, Norway.

#------------------------------
#This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2.

#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. <http://www.gnu.org/licenses/>.
#------------------------------


#gettext
FONTSIZE=60
echo 'export VERSION=1.0.2
export FONTSIZE='$FONTSIZE'
export COLOR1="#222222"
export COLOR2="#2CDD49"
export COLOR3="#EEA03F"
export SOUND_AT_START="/usr/share/audio/beep_high.wav"
export SOUND_BEFORE_START="/usr/share/audio/beep_low.wav"
export START_INTERVAL=30
export LATE_REGISTRATION=2' > $HOME/.ptiming/ptimingrc
	chmod 722 $HOME/.ptiming/ptimingrc

. $HOME/.ptiming/ptimingrc


echo 'style "monoBig" { font_name="Mono bold 50" base[NORMAL]="'$COLOR1'" text[NORMAL]="'$COLOR2'" }
widget "*timer" style "monoBig"
style "dejaColor" { font_name="Dejavu 40" base[NORMAL]="'$COLOR1'" text[NORMAL]="'$COLOR3'" }
widget "*edit" style "dejaColor"
style "dejaBig" { font_name="Mono bold 60" base[NORMAL]="'$COLOR1'" text[NORMAL]="'$COLOR3'"}
widget "*nr" style "dejaBig"' > $WORKDIR/gtkrc
export GTK2_RC_FILES=$WORKDIR/gtkrc:/root/.gtkrc-2.0 #include theme stuff with system themes

TEXT="AA"

export pTiming='
	<window height-request="250" width-request="350" skip-taskbar-hint="true" decorated="false">
	 <vbox>
	   <entry name="edit" text="Focus  is here" width-request="80" tooltip-text="'$(gettext 'Apply changes by pressing ENTER')'">
	    <input>echo '$TOUCHED_NR'</input>
	    <variable>EDIT_NR</variable>
			<action signal="activate">grabfocus:INGRESA</action>	    				
	   </entry>
	   <entry width-request="340" height-request="27">
	    <input>echo '$TOUCHED_NAME'</input>	    
	    <visible>disabled</visible>
	   </entry>
	   <entry name="timer" width-request="150" tooltip-text="'$(gettext 'Apply changes by pressing ENTER')'">
	        <variable>INGRESA</variable>	        
	        <action signal="activate">EXIT:apply</action>
	   </entry>
	   	    
	    <button visible="true" can-default="true" has-default="true">
			<action>EXIT:apply</action>
		</button>
	   
	 </vbox>
	 <action signal="focus-out-event">EXIT:exit</action>
	</window>'

inserta() {
	
	hola="FDAFDS"	
}; export -f inserta

##  modifile() {


gtkdialog -p pTiming 
	
hopefully one forum can review the code and improve it for example those in need.

I do not understand how it works but if it does what I need.

too

i found other examples using \ ".. \" but called off widgest. Example:

Code: Select all

#!/bin/bash
echo 'style "specialmono"
{
  font_name="Mono 12"
}
widget "*mono" style "specialmono"
class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono

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

export test_app="
<vbox>
  <text name=\"mono\"><label>This text-widget uses monospace font....</label></text>
  <text><label>...while this text-widget don't.</label></text>
  <edit><default>All edit-widgets gets monospace.</default></edit>
</vbox>"
gtkdialog --program=test_app
the \ ".. \" in <text name=\"mono\">, ,, but deactivated called widgest


excuse my english. I use traslator
comments?
Thanks!

Post Reply