GtkDialog - tips
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
To show the selection of a folder by the two possible
methods Xdialog or gtkdialog. Compare each method
and decide which is best.
I wrote a simple script to compress a folder that the user selects.
The big difference is that Xdialog adds a slash at end of path.
methods Xdialog or gtkdialog. Compare each method
and decide which is best.
I wrote a simple script to compress a folder that the user selects.
The big difference is that Xdialog adds a slash at end of path.
- Attachments
-
- compression-demo.tar.gz
- (1.32 KiB) Downloaded 463 times
Last edited by don570 on Sat 09 Jun 2012, 19:19, edited 1 time in total.
I wanted to show how it is possible to choose a folder and
enter data in another field at the same time.
To see the final application I created go HERE
Using the most recent version of gtkdialog this is possible
(See image) When the folder is choosen the time
to compress is calculated (using a simple estimate based on size)
and then displayed in box underneath.
Compare this with the old method where a
refresh button had to be clicked to make a calculation.
I've included two scripts to show the two methods.
Re quires the most recent version of gtkdialog
refresh button version...
___________________________________________________
enter data in another field at the same time.
To see the final application I created go HERE
Using the most recent version of gtkdialog this is possible
(See image) When the folder is choosen the time
to compress is calculated (using a simple estimate based on size)
and then displayed in box underneath.
Compare this with the old method where a
refresh button had to be clicked to make a calculation.
I've included two scripts to show the two methods.
Re quires the most recent version of gtkdialog
refresh button version...
___________________________________________________
- Attachments
-
- Gtkdialog-demos.tar.gz
- two scripts to demonstrate calulating time
- (1.85 KiB) Downloaded 440 times
I tried -a 0:0, then -a :hw, then -a 'hw:0,0', then -a 0:hw:0, but now, i know the right word!zigbert wrote: ...
'mpg321 /dir/file' to play a audio-file.
If you use 'ffmpeg -i "/dir/file" -f au - | aplay -D plughw' it will play mp3, ogg, wma, flac, wav, ... without including more dependencies.
...
Finally, i've found the solution! Thanks!
-=Quirky Linux -1.40=-
mpg321 -a :plughw -o alsa /folder/file.mp3
OR:
mpg321 -a 0,0:plughw -o alsa /folder/file.mp3
To share sound card which has no hardware sound mixing:
aoss mpg321 -o alsa /folder/file.mp3
To Zigbert
On the first page -----> scrolling text example
Is this line correct? Just one quote sign?
_______________________________________________
On the first page -----> scrolling text example
Is this line correct? Just one quote sign?
Code: Select all
while : ; do echo -e "x\n 100; sleep 0.5; done
I guess it should bedon570 wrote:To Zigbert
On the first page -----> scrolling text example
Is this line correct? Just one quote sign?
_______________________________________________Code: Select all
while : ; do echo -e "x\n 100; sleep 0.5; done
Code: Select all
while : ; do echo -e "x\n 100"; sleep 0.5; done
Scrolling text with <text> and <timer> widgets, added theme thrown in..
Code: Select all
#!/bin/sh
# Scrolling text & embedded timer event illustration #2
# using text and timer widgets
FG=$1 BG=$2 MSG=$3
! [ "$1" -a "$2" -a "$3" ] && echo "usage: $0 fg-color bg-color \"string\"" &&\
FG=white BG=black MSG="This is a test... I repeat: This is a test... "
echo 'style "gtkdialog-prog"
{
bg[NORMAL] = "'"$BG"'"
fg[NORMAL] = "'"$FG"'"
}
widget "*prog" style "gtkdialog-prog"
class "*" style "gtkdialog-prog"' > /tmp/gtkrc_prog
export GTK2_RC_FILES=/tmp/gtkrc_prog:/root/.gtkrc-2.0
function scrolltext() {
thestr="${1}"
echo -en "${thestr:2}${thestr:0:2}"
}
export SCROLLMSG="$MSG"
export -f scrolltext
export GTKBOX='
<window title="Embedded Timer Event #2">
<vbox width-request="300">
<text>
<variable>SCROLLMSG</variable>
<input>scrolltext "$SCROLLMSG"</input>
</text>
<timer interval="1" visible="false">
<action type="refresh">SCROLLMSG</action>
</timer>
</vbox>
</window>'
gtkdialog4 -p GTKBOX -c
unset GTKBOX
Puppy Linux Blog - contact me for access
A pity it can't refresh more often than once a second...
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
It candisciple wrote:A pity it can't refresh more often than once a second...
Code: Select all
<timer milliseconds="true" interval="200" visible="false">
Mick
I have cut down the code to give a simple-as-possible example.
Main post updated
I have cut down the code to give a simple-as-possible example.
Main post updated
Code: Select all
#!/bin/sh
export MSG="This is a test... I repeat: This is a test... "
export GTKBOX='
<vbox width-request="300">
<text>
<variable>MSG</variable>
<input>echo -en "${MSG:2}${MSG:0:2}"</input>
</text>
<timer milliseconds="true" interval="200" visible="false">
<action type="refresh">MSG</action>
</timer>
</vbox>'
gtkdialog4 -p GTKBOX
Cool!
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
restrain combobox
Two scripts AVAILABLE
I posted two scripts in programming section of forums
to demonstrate how to restrain the combobox
From a list of audio players , only the installed
audio players are shown.
________________________________________________________
I posted two scripts in programming section of forums
to demonstrate how to restrain the combobox
From a list of audio players , only the installed
audio players are shown.
________________________________________________________
- walter leonardo
- Posts: 234
- Joined: Thu 10 Dec 2009, 22:10
Help with gtk-dialog
Could you help me with mine program electricity for puppy linux I'm doing. I want to do the calculations by pressing "enter" instead of pressing the button "calculate". Could you do that for me?. Now I send the files.
I'd also like to know how to make programs in a single window with multiple tabs, each program in each tab.
I'd also like to know how to make programs in a single window with multiple tabs, each program in each tab.
- Attachments
-
- vatiohms.tar.gz
- (1 KiB) Downloaded 514 times
Walter, to make tabs in a single window use the <notebook> command. The syntax can be found on the first page of this thread.
This should give you a clue how to use the enter key to accept input.
#! /bin/bash
export DIALOG='
<window title="Enter password" icon-name="gtk-dialog-question">
<vbox>
<hbox>
<text>
<label>Label:</label>
</text>
<entry activates-default="true">
<variable>PASS0</variable>
<visible>password</visible>
</entry>
</hbox>
<hbox>
<button cancel></button>
<button can-default="true" has-default="true" use-stock="true">
<label>gtk-ok</label>
</button>
</hbox>
</vbox>
</window>
'
eval $(gtkdialog --program=DIALOG)
echo "$PASS0"
This should give you a clue how to use the enter key to accept input.
#! /bin/bash
export DIALOG='
<window title="Enter password" icon-name="gtk-dialog-question">
<vbox>
<hbox>
<text>
<label>Label:</label>
</text>
<entry activates-default="true">
<variable>PASS0</variable>
<visible>password</visible>
</entry>
</hbox>
<hbox>
<button cancel></button>
<button can-default="true" has-default="true" use-stock="true">
<label>gtk-ok</label>
</button>
</hbox>
</vbox>
</window>
'
eval $(gtkdialog --program=DIALOG)
echo "$PASS0"
To activate <entry> from enter-key you could use the 'activate' signal.
Code: Select all
<entry>
<action signal="activate">command</action>
</entry>
- walter leonardo
- Posts: 234
- Joined: Thu 10 Dec 2009, 22:10
Help with gtk-dialog
Use the function of the enter key and if it works, but only in a "Calcular" button and I want to get all the buttons work in "calcular"
As you would?
As you would?
Code: Select all
#!/bin/bash
#Autor: Walter Leonardo Iñiguez
MAIN_DIALOG='
<window title="Programa VatiOhms">
<notebook page="0" labels=" Tab 1| Tab 2| Tab 3| Tab 4">
<vbox>
<frame Calcular el Voltaje: V=I.R >
<hbox>
<text>
<label>Ingrese Resistencia (Ohm): </label>
</text>
<entry>
<default>""</default>
<variable>Resistencia</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry>
<default>""</default>
<variable>V</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Ingrese Corriente (Ampere):</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Corriente</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Val</variable>
</entry>
</hbox>
<hbox>
<text>
<label>El voltaje es: </label>
</text>
<entry>
<variable>Voltaje</variable>
<input>echo "scale=6;$Resistencia*$Corriente" | bc</input>
<input>echo "scale=6;$V/$Corriente" | bc</input>
<input>echo "scale=6;sqrt($Val*$Resistencia)" | bc</input>
</entry>
<text>
<label>Volts</label>
</text>
</hbox>
<hbox>
<button>
<label>Borrar datos</label>
<action type="clear">Voltaje</action><action type="clear">Resistencia</action><action type="clear">Corriente</action><action type="clear">V</action><action type="clear">Val</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
<label>Calcular</label>
<action>refresh:Voltaje</action>
</button>
</hbox>
</frame>
<frame Calcular la Resistencia: R=V/I >
<hbox>
<text>
<label>Ingrese Tensión (Volt): </label>
</text>
<entry>
<default>""</default>
<variable>Volts</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry>
<default>""</default>
<variable>Va</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Ingrese Corriente (Ampere):</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Amper</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Vas</variable>
</entry>
</hbox>
<hbox>
<text>
<label>La resistencia es: </label>
</text>
<entry>
<variable>Resistor</variable>
<input>echo "scale=3;$Volts/$Amper" | bc</input>
<input>echo "scale=3;($Va/$Amper)/$Amper" | bc</input>
<input>echo "scale=3;$Volts/($Vas/$Volts)" | bc</input>
</entry>
<text>
<label>Ohms</label>
</text>
</hbox>
<hbox>
<button>
<label>Borrar datos</label>
<action type="clear">Resistor</action><action type="clear">Volts</action><action type="clear">Amper</action><action type="clear">Va</action><action type="clear">Vas</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
<label>Calcular</label>
<action>refresh:Resistor</action>
</button>
</hbox>
</frame>
<frame Calcular la Corriente: I=V/R >
<hbox>
<text>
<label>Ingrese Tensión (Volt): </label>
</text>
<entry>
<default>""</default>
<variable>Tensio</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry>
<default>""</default>
<variable>Vac</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Ingrese Resistencia (Ohm): </label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Resisten</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Vat</variable>
</entry>
</hbox>
<hbox>
<text>
<label>La Corriente es: </label>
</text>
<entry>
<variable>Corrient</variable>
<input>echo "scale=6;$Tensio/$Resisten" | bc</input>
<input>echo "scale=6;$Vat/$Tensio" | bc</input>
<input>echo "scale=6;(sqrt($Vac*$Resisten))/$Resisten" | bc</input>
</entry>
<text>
<label>Amperes</label>
</text>
</hbox>
<hbox>
<button>
<label>Borrar datos</label>
<action type="clear">Corrient</action><action type="clear">Tensio</action><action type="clear">Resisten</action><action type="clear">Vat</action><action type="clear">Vac</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
<label>Calcular</label>
<action>refresh:Corrient</action>
</button>
</hbox>
</frame>
<frame Calcular los Vatios (Watts): W=I.V >
<hbox>
<text>
<label>Ingrese Tensión (Volt): </label>
</text>
<entry>
<default>""</default>
<variable>Tensione</variable>
</entry>
<text>
<label>o resistencia</label>
</text>
<entry>
<default>""</default>
<variable>Vad</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Ingrese Corriente (Ampere): </label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Amperiore</variable>
</entry>
<text>
<label>o resistencia</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Vag</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Los Vatios son: </label>
</text>
<entry>
<variable>Vatios</variable>
<input>echo "scale=6;$Tensione*$Amperiore" | bc</input>
<input>echo "scale=6;($Vad*$Amperiore)*$Amperiore" | bc</input>
<input>echo "scale=6;($Tensione/$Vag)*$Tensione" | bc</input>
</entry>
<text>
<label>Vatios</label>
</text>
</hbox>
<hbox>
<button>
<label>Borrar datos</label>
<action type="clear">Vatios</action><action type="clear">Tensione</action><action type="clear">Amperiore</action><action type="clear">Vad</action><action type="clear">Vag</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
<label>Calcular</label>
<action>refresh:Vatios</action>
</button>
</hbox>
</frame>
<hbox>
<button>
<label>BORRAR TODOS LOS DATOS</label>
<action type="clear">Resistor</action><action type="clear">Volts</action><action type="clear">Amper</action><action type="clear">Va</action><action type="clear">Vas</action><action type="clear">Vatios</action><action type="clear">Tensione</action><action type="clear">Amperiore</action><action type="clear">Vad</action><action type="clear">Vag</action><action type="clear">Corrient</action><action type="clear">Tensio</action><action type="clear">Resisten</action><action type="clear">Vat</action><action type="clear">Vac</action><action type="clear">Voltaje</action><action type="clear">Resistencia</action><action type="clear">Corriente</action><action type="clear">V</action><action type="clear">Val</action>
</button>
<button>
<label>SALIR</label>
<action>exit:EXIT</action>
</button>
</hbox>
</vbox>
</notebook>
</window>
' gtkdialog3 --program=MAIN_DIALOG
- walter leonardo
- Posts: 234
- Joined: Thu 10 Dec 2009, 22:10
Help with gtk-dialog
Now use the function tabs in my program and it worked well with the function of the enter key, but the enter key works only see in every window. What would be the problem?
Code: Select all
#!/bin/bash
#Autor: Walter Leonardo Iñiguez
MAIN_DIALOG='
<window title="Programa VatiOhms">
<notebook page="0" labels=" Tab 1| Tab 2| Tab 3| Tab 4">
<vbox>
<frame>
<text use-markup="true">
<label>"<b><u>Calcular el Voltaje: V=I.R</u></b>"</label>
</text>
<hbox>
<text>
<label>Ingrese Resistencia (Ohm): </label>
</text>
<entry>
<default>""</default>
<variable>Resistencia</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry>
<default>""</default>
<variable>V</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Ingrese Corriente (Ampere):</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Corriente</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Val</variable>
</entry>
</hbox>
<hbox>
<text>
<label>El voltaje es: </label>
</text>
<entry>
<variable>Voltaje</variable>
<input>echo "scale=6;$Resistencia*$Corriente" | bc</input>
<input>echo "scale=6;$V/$Corriente" | bc</input>
<input>echo "scale=6;sqrt($Val*$Resistencia)" | bc</input>
</entry>
<text>
<label>Volts</label>
</text>
</hbox>
<hbox>
<button>
<label>Borrar datos</label>
<action type="clear">Voltaje</action><action type="clear">Resistencia</action><action type="clear">Corriente</action><action type="clear">V</action><action type="clear">Val</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
<label>Calcular</label>
<action>refresh:Voltaje</action>
</button>
</hbox>
</frame>
</vbox>
<vbox>
<frame Calcular la Resistencia: R=V/I >
<hbox>
<text>
<label>Ingrese Tensión (Volt): </label>
</text>
<entry>
<default>""</default>
<variable>Volts</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry>
<default>""</default>
<variable>Va</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Ingrese Corriente (Ampere):</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Amper</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Vas</variable>
</entry>
</hbox>
<hbox>
<text>
<label>La resistencia es: </label>
</text>
<entry>
<variable>Resistor</variable>
<input>echo "scale=3;$Volts/$Amper" | bc</input>
<input>echo "scale=3;($Va/$Amper)/$Amper" | bc</input>
<input>echo "scale=3;$Volts/($Vas/$Volts)" | bc</input>
</entry>
<text>
<label>Ohms</label>
</text>
</hbox>
<hbox>
<button>
<label>Borrar datos</label>
<action type="clear">Resistor</action><action type="clear">Volts</action><action type="clear">Amper</action><action type="clear">Va</action><action type="clear">Vas</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
<label>Calcular</label>
<action>refresh:Resistor</action>
</button>
</hbox>
</frame>
</vbox>
<vbox>
<frame Calcular la Corriente: I=V/R >
<hbox>
<text>
<label>Ingrese Tensión (Volt): </label>
</text>
<entry>
<default>""</default>
<variable>Tensio</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry>
<default>""</default>
<variable>Vac</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Ingrese Resistencia (Ohm): </label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Resisten</variable>
</entry>
<text>
<label>o vatios</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Vat</variable>
</entry>
</hbox>
<hbox>
<text>
<label>La Corriente es: </label>
</text>
<entry>
<variable>Corrient</variable>
<input>echo "scale=6;$Tensio/$Resisten" | bc</input>
<input>echo "scale=6;$Vat/$Tensio" | bc</input>
<input>echo "scale=6;(sqrt($Vac*$Resisten))/$Resisten" | bc</input>
</entry>
<text>
<label>Amperes</label>
</text>
</hbox>
<hbox>
<button>
<label>Borrar datos</label>
<action type="clear">Corrient</action><action type="clear">Tensio</action><action type="clear">Resisten</action><action type="clear">Vat</action><action type="clear">Vac</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
<label>Calcular</label>
<action>refresh:Corrient</action>
</button>
</hbox>
</frame>
</vbox>
<vbox>
<frame Calcular los Vatios (Watts): W=I.V >
<hbox>
<text>
<label>Ingrese Tensión (Volt): </label>
</text>
<entry>
<default>""</default>
<variable>Tensione</variable>
</entry>
<text>
<label>o resistencia</label>
</text>
<entry>
<default>""</default>
<variable>Vad</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Ingrese Corriente (Ampere): </label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Amperiore</variable>
</entry>
<text>
<label>o resistencia</label>
</text>
<entry activates-default="true">
<default>""</default>
<variable>Vag</variable>
</entry>
</hbox>
<hbox>
<text>
<label>Los Vatios son: </label>
</text>
<entry>
<variable>Vatios</variable>
<input>echo "scale=6;$Tensione*$Amperiore" | bc</input>
<input>echo "scale=6;($Vad*$Amperiore)*$Amperiore" | bc</input>
<input>echo "scale=6;($Tensione/$Vag)*$Tensione" | bc</input>
</entry>
<text>
<label>Vatios</label>
</text>
</hbox>
<hbox>
<button>
<label>Borrar datos</label>
<action type="clear">Vatios</action><action type="clear">Tensione</action><action type="clear">Amperiore</action><action type="clear">Vad</action><action type="clear">Vag</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
<label>Calcular</label>
<action>refresh:Vatios</action>
</button>
</hbox>
</frame>
<hbox>
<button>
<label>BORRAR TODOS LOS DATOS</label>
<action type="clear">Resistor</action><action type="clear">Volts</action><action type="clear">Amper</action><action type="clear">Va</action><action type="clear">Vas</action><action type="clear">Vatios</action><action type="clear">Tensione</action><action type="clear">Amperiore</action><action type="clear">Vad</action><action type="clear">Vag</action><action type="clear">Corrient</action><action type="clear">Tensio</action><action type="clear">Resisten</action><action type="clear">Vat</action><action type="clear">Vac</action><action type="clear">Voltaje</action><action type="clear">Resistencia</action><action type="clear">Corriente</action><action type="clear">V</action><action type="clear">Val</action>
</button>
<button>
<label>SALIR</label>
<action>exit:EXIT</action>
</button>
</hbox>
</vbox>
</notebook>
</window>
' gtkdialog3 --program=MAIN_DIALOG
Can anyone offer a simple gtkdialog GUI for netcat.
I would like to be able to run netcat in backgrounded listening mode when I start the computer. If someone was to call me using netcat, my system should open a chat window so the caller and callee can chat.
It's easy enough to do it in two terminal on the local and remote computer.
EG: listening computer:
netcat -lp <port>
EG: Calling computer:
netcat 192.168.x.x <port>
Both terminals will connect and you can chat in the terminal windows.
This can also be done on a WAN but you need to do some port forwarding.
I would also be happy just to use the terminal/console as long as it is backgrounded until invoked by the caller. I just don't want in in the tray until it's required.
Thanks
I would like to be able to run netcat in backgrounded listening mode when I start the computer. If someone was to call me using netcat, my system should open a chat window so the caller and callee can chat.
It's easy enough to do it in two terminal on the local and remote computer.
EG: listening computer:
netcat -lp <port>
EG: Calling computer:
netcat 192.168.x.x <port>
Both terminals will connect and you can chat in the terminal windows.
This can also be done on a WAN but you need to do some port forwarding.
I would also be happy just to use the terminal/console as long as it is backgrounded until invoked by the caller. I just don't want in in the tray until it's required.
Thanks