Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCL Banner

Status
Not open for further replies.

coffeysm

MIS
Oct 7, 2004
571
US
I am extremely new to the TCL/TK language and have been trying to get something similar to a banner to work. What I have so far is:

Code:
#!/usr/local/bin/wish8.0
set USER [exec env | grep USER= | cut -d= -f2]
set HOST [exec hostname]
label .main -text "$USER TOP SECRET SI/TK $HOST" -background yellow
pack .main

I was wondering if anyone could help me so it could perform the following as well:

Code:
1. Centered at the top of the screen
2. On top of all applications
3. No borders displayed just the text.

Any help I would greatly appreciate.

Thanks,
Steve
 
as to 3:
wm overrideredirect window ?boolean?
If boolean is specified, it must have a proper boolean form and the override-redirect flag for window is set to that value. If boolean is not specified then 1 or 0 is returned to indicate whether or not the override-redirect flag is currently set for window. Setting the override-redirect flag for a window causes it to be ignored by the window manager; among other things, this means that the window will not be reparented from the root window into a decorative frame and the user will not be able to manipulate the window using the normal window manager mechanisms.

as for 2:
wm attributes window ?option value option value...?
This subcommand returns or sets platform specific attributes associated with a window. The first form returns a list of the platform specific flags and their values. The second form returns the value for the specific option. The third form sets one or more of the values. The values are as follows:
On Windows, -disabled gets or sets whether the window is in a disabled state. -toolwindow gets or sets the style of the window to toolwindow (as defined in the MSDN). -topmost gets or sets whether this is a topmost window (displays above all other windows).

as for 1, I think I used to know how to do this but I seem to have forgotten.

_________________
Bob Rashkin
 
Bong,

Thanks a lot of your help...

wm attributes was not available in my version. So, I just set the width of the label.

I modified it now to read:

Code:
#!/usr/local/bin/wish8.0
set USER [exec env | grep USER= | cut -d= -f2]
set HOST [exec hostname]
label .main -text "$USER TOP SECRET SI/TK $HOST" -background yellow
pack .main
wm overrideredirect . 1
 
Thanks feherke I was trying to whip something up fast and that was all I could come up with at the time. I could not figure out how to read in UNIX variables, now I know how to.
Thanks!
 
Ok...well I finished my script and thought I would post it for anybody else who would be interested.

Code:
#!/usr/local/bin/wish8.0
set USER $env(USER)
set HOST [exec hostname]
set w [winfo screenwidth .]
set width [expr $w/4]
#
wm maxsize . $width $width
wm geometry . +[expr $w/2 - $width/2]+0
wm resizable . 0 0
wm overrideredirect . 1
label .main -text "$USER TOP SECRET SI/TK $HOST" -background yellow
pack .main
I had to mess around with the math to get it centered on the screen and what not. If anyone sees anything I can improve or modify let me know.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top