Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Showing graphical temperature with Tcl/Tk

150 views
Skip to first unread message

Cecil Westerhof

unread,
Dec 19, 2017, 4:14:06 AM12/19/17
to
I just started with Tcl and now also with Tk. But I like it and I
think it will supplant my Bash usage.

I already wrote a little script that shows my CPU temperature in a
console. But it would be much better to do this with Tk.

I measure the temperature every minute. I would think to show a graph
from the last 60 minutes and beside that the current temperature. The
last part I know, but any pointers about how to display the graph?

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Arjen Markus

unread,
Dec 19, 2017, 4:35:41 AM12/19/17
to
The Wiki has plenty of pointers for that, BLT is a well-known package for plotting, I myself often use Plotchart (part of Tklib). I am a trifle biased, though, as I developed it together with contributions from others.

It sounds like you are looking for a stripchart facility. Both packages can do that.

Regards,

Arjen

Christian Gollwitzer

unread,
Dec 19, 2017, 5:01:35 AM12/19/17
to
Hi Cecil,

Am 19.12.17 um 10:08 schrieb Cecil Westerhof:
> I measure the temperature every minute. I would think to show a graph
> from the last 60 minutes and beside that the current temperature. The
> last part I know, but any pointers about how to display the graph?

I'm also a bit biased as the author of yet another plot package called ukaz:

https://github.com/auriocus/ukaz

One of the demos is actually similar to your request:

https://github.com/auriocus/ukaz/blob/master/demo/linuxload.tcl

It displays a graph of the load average on Linux.

Christian

Cecil Westerhof

unread,
Dec 19, 2017, 5:14:05 AM12/19/17
to
OK, thanks. I will look into that as soon as I have a basic
understanding of Tk.

Rich

unread,
Dec 19, 2017, 6:00:55 AM12/19/17
to
Cecil Westerhof <Ce...@decebal.nl> wrote:
> I just started with Tcl and now also with Tk. But I like it and I
> think it will supplant my Bash usage.
>
> I already wrote a little script that shows my CPU temperature in a
> console. But it would be much better to do this with Tk.
>
> I measure the temperature every minute. I would think to show a graph
> from the last 60 minutes and beside that the current temperature. The
> last part I know, but any pointers about how to display the graph?

1) Install TkLib, use the 'plotchart' widget. Several wiki links:

http://wiki.tcl-lang.org/11265 (plotchart)
http://wiki.tcl-lang.org/18167 (Plotchart gallery)
http://wiki.tcl-lang.org/28514 (Some more Plotchart examples)
http://wiki.tcl-lang.org/28179 (Interactive plotting with Plotchart)
http://wiki.tcl-lang.org/21144 (An interactive tutorial for Plotchart)
http://wiki.tcl-lang.org/48910 (Data selection in plotchart)
http://wiki.tcl-lang.org/26050 (Extensions to Plotchart)
http://wiki.tcl-lang.org/26064 (Extensions to Plotchart 2)

2) Or read these pages:

http://wiki.tcl-lang.org/1123 (How to plot a graph)
http://wiki.tcl-lang.org/9503 (Chart generation support)
http://wiki.tcl-lang.org/10552 (Plotting a simple graph)
http://wiki.tcl-lang.org/13680 (A little bar chart)
http://wiki.tcl-lang.org/988 (A little function plotter)
http://wiki.tcl-lang.org/8552 (A little graph plotter)

#1 is the "I want a temperature graph with the least amount of work"
set of links. #2 is the "I want to know how to draw a graph from a
dataset" set of links (although reading the plotchart source would
likely help here slightly as well).


Cecil Westerhof

unread,
Dec 19, 2017, 7:28:06 AM12/19/17
to
Thank you. I think both will be interesting.

I am afraid I will not get bored soon. ;-)

keithv

unread,
Dec 20, 2017, 9:35:25 PM12/20/17
to
On Tuesday, December 19, 2017 at 1:14:06 AM UTC-8, Cecil Westerhof wrote:
> I just started with Tcl and now also with Tk. But I like it and I
> think it will supplant my Bash usage.
>
> I already wrote a little script that shows my CPU temperature in a
> console. But it would be much better to do this with Tk.
>
> I measure the temperature every minute. I would think to show a graph
> from the last 60 minutes and beside that the current temperature. The
> last part I know, but any pointers about how to display the graph?

The NOAA Weather Forecast page on wiki (http://wiki.tcl.tk/17514) has a graph of temperatures which you could use as a guide. It uses plotchart to do the heavy lifting. Checkout the procedure PlotTemp.

Keith

ifind...@gmail.com

unread,
Jan 31, 2018, 5:38:35 PM1/31/18
to
Have a look at TclFltk. It has instant plotting widgets and extensive documentation.
0 new messages