4

I want to display some output in a separate Window but WITHOUT all the usual Windows accoutrements. I don't want a title bar, I don't want a menu of options, I don't want a scroll bars - I just want a simple "frame" with my graphic output sitting within it.

I have been successful in creating a separate window using code like:

nb = CreateDocument[
       Dynamic[pictureWindow], WindowFrame -> "Palette", 
       WindowTitle -> None, WindowSize -> {200, 100}]; 

. . . but this gives me all the (to me, in this instance) extraneous stuff.

How could I generate a new window and control its displayed elements?

MarcoB
  • 67,153
  • 18
  • 91
  • 189
Adrian
  • 41
  • 2
  • Do you want to be able to move the "output" window? – chuy Jun 08 '20 at 17:59
  • It's not essential - I'd just like to display it in a fixed place on the screen, I don't mind if some default position is selected. However, it would be nice to specify the position on my screenthat the "window" will appear. The window is opened multiple times in my program and it should appear in the same position each time it is opened. – Adrian Jun 08 '20 at 19:28

1 Answers1

3

For the "output" window:

nbout = CreateDocument[{}, WindowFrame -> "ThinFrame", 
   WindowElements -> {},
   WindowToolbars -> {}, WindowSize -> Medium, 
   WindowMargins -> {{Automatic, 0}, {Automatic, 0}}, 
   Deployed -> True, ShowCellBracket -> False];

and this will put "output" into this notebook

$Post = Function[expr, SelectionMove[nbout, Previous, Cell]; 
   NotebookWrite[nbout, 
    Cell[BoxData@ToBoxes@expr, "Output", 
     CellLabel -> "Out[" <> ToString@$Line <> "]:=", 
     ShowCellLabel -> True]]];

Mathematica graphics

Alternatively, you could use Dynamic instead, with

nbout = CreateDocument[{TextCell["Output", "Section"], 
    Dynamic[outputCell]}, WindowFrame -> "ThinFrame", 
   WindowElements -> {},
   WindowToolbars -> {}, WindowSize -> Medium, 
   WindowMargins -> {{Automatic, 0}, {Automatic, 0}}, 
   Deployed -> True, ShowCellBracket -> False];

and

$Post = ((outputCell = #); Null) &

but the first method could easily be modified to keep a running list of outputs (just change SelectionMove[nbout, Previous, Cell] to SelectionMove[nbout, Next, Cell], and I like having the cell labels.

One could use NotebookClose[nbout] to close the window.

chuy
  • 11,205
  • 28
  • 48
  • Thank you so much, chuy. Your precise and helpful answer solved my problem completely. I am in your debt. – Adrian Jun 09 '20 at 05:06