4
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ Do you want to be able to move the "output" window? $\endgroup$ – chuy Jun 8 '20 at 17:59
  • $\begingroup$ 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. $\endgroup$ – Adrian Jun 8 '20 at 19:28
3
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Thank you so much, chuy. Your precise and helpful answer solved my problem completely. I am in your debt. $\endgroup$ – Adrian Jun 9 '20 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.