4

In Tcl/Tk, the source of file /usr/bin/wan27

#! /usr/bin/wish -f
set w .main
toplevel $w
wm title $w "FOO"

when issuing the command "wan27" from terminal (Linux/Debian/Ubuntu 10.04), it opens two windows, one with the title wan27 and the other one with the title FOO. I just want the FOO window to open. How can I fulfill that?

Thanks

Drakosha
  • 11,925
  • 4
  • 39
  • 52
fabjoa
  • 1,615
  • 3
  • 15
  • 15

4 Answers4

3

Use the following:

#! /usr/bin/wish -f
wm title . "FOO"
Drakosha
  • 11,925
  • 4
  • 39
  • 52
  • cool, i was actually bumping a blog explaing widget path, so this is how to access current window! tx! – fabjoa Nov 21 '10 at 16:46
  • 1
    @fabjoa: It's not how to access the "current" window, it's how to access the default window. There's no real notion of "current" window, except maybe as relates to what window has focus. – Bryan Oakley Nov 21 '10 at 20:32
  • @Bryan: Well, there's also the grab window and the window with the mouse pointer over it. But you're right, there's no real “current” window; GUIs don't work like that (which is what makes them hard to code for for most people). – Donal Fellows Nov 22 '10 at 01:14
3

The answer is that wish always creates a window named ".". So that is one window. You then create a second window with the toplevel command so now you have two.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • i now get it! wish, automatically opens a window upon call. things are getting clearer with "ticle" poco a poco! Thanks,bryan! – fabjoa Nov 21 '10 at 22:47
1

You can use also:

wm state . withdrawn
Roman Kaganovich
  • 618
  • 2
  • 6
  • 27
0

If you want to ignore . then you can just hide it: wm iconify .

glenn jackman
  • 238,783
  • 38
  • 220
  • 352