Version 2 of Questions related to windows

Updated 2011-02-06 10:48:35 by Didier

Running two copies of the program simultaneously or setting up two windows with one copy of the program running

Didier(Saturday February 5th 2011) I'd like to program my editor so that two copies of the program run at the same time: the first version of the Editor will occupy one half of the screen and the second one will occupy the other half. I am doing this so that I can copy and paste parts of documents more easily than if I open two copies of the program on two different windows. How should I proceed? Please note once again that I'd like the two programs to open at the same time on split screen. Tx!

RLE (2011-05-05): Your question appears to mix some metaphors. Do you really want two independent copies of the program, or are you just asking for a split-screen, side-by-side view of two documents? I.e., you want one big window, which contains two document views side by side? If so you should take a look at the ttk::panedwindow widget if you are running 8.5.x. You can put two text widgets inside of it side by side.

Or, you could just open two top level windows, put one text widget in each, and then using the wm command, adjust the sizes and positions of the two windows so that the each take up a half screen, and sit side by side.

Didier (2011-02-05) Tx RLE. I imperatively must open two copies of the same program for technical reasons and not simply two windows.

RLE (2011-02-05) fails to understand why such technical reasons exist, but suggests you take a look at How to embed a non-Tk GUI into a Tk frame which part way down mentions BLT containers among other ideas. You could also take a look at Embedding Windows applications in Tk frames. However I fear both will be suboptimal. You may simply find it easiest to either manually position and size both independent windows, or to include some form of command line argument or push button that sizes the windows appropriately. I.e., a -left/-right command line argument that causes the relevant window to be 1/2 screen on the left or right side, or a pair of buttons "Left" "Right" that reposition/size their parent toplevel to be 1/2 screen, left or right side.


Didier Saturday (February 5th 2011) This is a pretty dumb question. I have in my code the following width: .pw.add.pw.left -width 310

What do I have to do to set the height? This? .pw.add.pw.left -height 110. I tried and it does not work. Any idea what should be typed in?

I have another question: I see pw.forget in the code. What does this forget do? What does it forget? :-) Thanks!

RLE (2011-02-05): Without knowing what kind of widget that path (.pw.add.pw.left) refers to, it is impossible to answer your question.

As to pw.forget, as we are not physic, we can't tell. "pw.forget" is not a built-in Tcl or Tk command, so it must refer to a proc that the code you are looking at has defined. So you will have to find the definition of pw.forget to find out what it does. Unless you meant ".pw.forget" (widget path), in which case, the answer is almost the same, look in the code for where "pw.forget" or ".pw.forget" is defined, and read what it does there.