How to use a GTK horizontal scroll bar for a progress bar?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

How to use a GTK horizontal scroll bar for a progress bar?

#1 Post by sunburnt »

I wrote a script to track the percent of a file that has been copied.
Now I need a graphical display, a horizontal scroll bar is the easiest way.
I need the scroll bar to popup and it`s position controlled by my script.

I`ve looked at GTK before and couldn`t make any sense of it.
I couldn`t get anything to work in GTK from a Bash script.
This will be a good way to begin my understanding of how to use GTK.

In Visual Basic this is a snap to do, I would even make an ActiveX of it.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

Code: Select all

#!/bin/bash

percent=0
(
while test $percent != 110
do
echo $percent
percent=`expr $percent + 10`
sleep 1
done
) |
Xdialog --title "Gauge works!" --gauge "This is how a gauge appears on the command line" 10 60 0
greets, Mark (currently 1 week in holiday, so not posting much)
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#3 Post by Pizzasgood »

Just a small point: that works fine as a script, but if you wanted to actually type those commands into the terminal and run it that way, the string with the exclamation mark in it would need to use single-quotes rather than double-quotes (or be omitted). Otherwise it gives an error.

Works fine as a script though.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#4 Post by sunburnt »

Thanks Pizzasgood; Man this is a cool forum... I love it!

MU; I completely forgot about the xDialog gauge control.
I didn`t think there was one... Got a nice CL copy working with a GUI.

Now I`m thinking a full blown file browser like WinExplorer.
So I`m looking at gtkDialog controls and I can`t see how the tree works.
It has sub nodes, but I don`t see how they`re controlled, really odd...
xDialogs treeview is easy to control, it`s a little weird but that`s xDialog.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#5 Post by sunburnt »

Seems that the gtkDialog-2 tree sub branches the item if it`s the same as the last item.
But it does not seem to have any method of control over the branch`s structure.
The original tree_multicolumn control has 2 levels of branches.
But if I modify it then there`s only 2 levels, really odd...

I asked zigbert and he didn`t know... Any ideas anyone???

Post Reply