Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 09 Nov 1997 19:27:46 -0700
From:      Warner Losh <imp@village.org>
To:        mobile@freebsd.org
Subject:   A little tk program
Message-ID:  <199711100227.TAA20649@harmony.village.org>

next in thread | raw e-mail | index | archive | help
ok.  I have a small tcl/tk prorgam that works under tk 4.2 (since I
have ical installed).  It displays the current battary level.  It
should work with 8.0 as well.  Enjoy.  Comments welcome.  Only about
1M of memory is needed :-(.

Warner

P.S. You need to run this as root, or have apm be setuid root.
P.P.S.  Mike Smith: now I understand why you like tk so much....

#! /usr/local/bin/wish4.2
proc updateBattery {} {
	global batteryLevel

	set batteryLevel [exec apm -l]
	wm iconname . [format "%d%%" $batteryLevel]
	after 30000 updateBattery
}

label .label -text "Battery Level"
pack .label
scale .scale -from 0 -to 100 \
	-length 100 \
	-variable batteryLevel \
	-orient horizontal \
	-showvalue true
pack .scale
updateBattery



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711100227.TAA20649>