8
$\begingroup$

Is it possible to create a full-screen graphics without any front end elements like cell brackets and scrollbars? The zero approximation can be

{{{z, w}, {z, h}}} = FullScreenArea /. (ScreenInformation /. 
     Options[$FrontEnd, ScreenInformation]);
CreateDocument[
  Graphics[{EdgeForm[Green], Rectangle[{0, 0}, {w, h} - 1], Red, 
    AbsolutePointSize[1], Point[{100, 100}]},
   PlotRange -> {{0, w - 1}, {0, h - 1}}, ImageSize -> {w, h}],
  WindowSize -> Full];

As a result I expect a black screen with green border of one pixel width and one red pixel. I guess some options are missing to do the job, but there are quite many places one could try to put them to, so I expect someone more familiar with this functionality will respond.

$\endgroup$
4
  • $\begingroup$ One option is to change CreateDocument to MessageDialog. Would that be something that's acceptable to you? $\endgroup$
    – rm -rf
    Dec 24, 2012 at 15:55
  • $\begingroup$ This is much better, but still not the desired result. The goal is to get the whole monitor screen as a canvas. $\endgroup$
    – faleichik
    Dec 24, 2012 at 16:11
  • 2
    $\begingroup$ How about the options WindowSize->Full, ShowCellBracket -> False, WindowFrame -> "ThinFrame", WindowElements -> {}, WindowFrameElements -> {}? (or "Frameless" instead of "ThinFrame") $\endgroup$
    – kglr
    Dec 24, 2012 at 17:11
  • $\begingroup$ Good one - would also come in very handy for presentations with fullscreen image content which usually drives me back to Powerpoint. $\endgroup$
    – Yves Klett
    Dec 24, 2012 at 18:03

1 Answer 1

6
$\begingroup$

It seems to me that you would want some sort of flexibility with this. Just setting the window size to full may not be the best solution. If I was doing it I would prefer to be making a notebook with the graphics filling the entire notebook and then toggling full screen with your graphics size to changing accordingly. To do this you need to make the image size dynamic.

CreateDocument[
  Plot[Sin[x], {x, 0, 3 Pi}, 
   ImageSize -> 
    Dynamic@AbsoluteCurrentValue[EvaluationNotebook[], WindowSize]],
  CellMargins -> 0,
  "BlinkingCellInsertionPoint" -> False,
  "CellInsertionPointCell" -> {},
  Saveable -> True,
  ShowCellBracket -> False,
  ShowCellLabel -> False,
  "TrackCellChangeTimes" -> False,
  StyleDefinitions -> "Default.nb",
  WindowFrameElements -> {"CloseBox", "ZoomBox", "MinimizeBox"},
  WindowElements -> {},
  WindowFrame -> "Normal",
  WindowSize -> All,
  WindowMargins -> Automatic,
  WindowTitle -> ""];

This is a variation of something I currently use. What happens is that initially your window opens and you control whether it goes full screen via keystrokes. On my system this means Control-Command-F (see screen grab below). When you toggle full screen the graphic expands to fit the screen. Toggle back and it shrinks to its original size. I set WindowSize->All initially but you may prefer to give the window a value e.g. {600,600}. I have used a plot to illustrate the resizing. You should set your AspectRatio to be the same as your full screen otherwise the graphic won't fit to your full screen properly. My screen aspect ratio is 5/8 so:

CreateDocument[
  Graphics[{EdgeForm[Green], Rectangle[]},
   AspectRatio -> 5/8, 
   ImageSize -> 
    Dynamic@AbsoluteCurrentValue[EvaluationNotebook[], WindowSize]],
  CellMargins -> 0,
  "BlinkingCellInsertionPoint" -> False,
  "CellInsertionPointCell" -> {},
  Saveable -> True,
  ShowCellBracket -> False,
  ShowCellLabel -> False,
  "TrackCellChangeTimes" -> False,
  StyleDefinitions -> "Default.nb",
  WindowFrameElements -> {"CloseBox", "ZoomBox", "MinimizeBox"},
  WindowElements -> {},
  WindowFrame -> "Normal",
  WindowSize -> {640, 400},
  WindowMargins -> Automatic,
  WindowTitle -> ""];

Alternatively you could make the aspect ratio dynamic as well. Note that you will see white around the graphic. To remove this set PlotRangePadding->0. The grab below shows the notebook prior to going full screen.

enter image description here

In the screen grab I used Red, AbsolutePointSize[1], Point[Scaled[{0.5, 0.5}]]. If you want to have the point position in pixel units and plot range in pixels then you would need to make some adjustments -- if you want to go down that path I will adjust the code. Personally I think using Scaled is better for managing this.

$\endgroup$
1
  • 1
    $\begingroup$ To make aspect ratio dynamic: AspectRatio -> All $\endgroup$
    – Dan Oak
    Jun 26, 2021 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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