Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is my next attempt.
- GetCode[] := Cell[BoxData[
- StyleBox[
- DynamicBox[ToBoxes[Refresh[
- InputForm @@ MakeExpression@
- First@First@
- Cases[NotebookGet[EvaluationNotebook[]][[1]],
- Cell[___, CellTags -> "MyGraphic", ___], Infinity]
- , UpdateInterval -> 1], StandardForm]
- ], StripOnInput -> False, LineColor -> GrayLevel[0.5],
- FrontFaceColor -> GrayLevel[0.5],
- BackFaceColor -> GrayLevel[0.5], GraphicsColor -> GrayLevel[0.5],
- FontColor -> GrayLevel[0.5]]
- ], "Output", CellTags -> "MyCode"];
- DynamicQ[] := (
- Length@Cases[
- Cases[NotebookGet[EvaluationNotebook[]][[1]],
- Cell[___, CellTags -> "MyCode", ___], Infinity]
- , DynamicBox[___]
- , Infinity] == 1
- );
- CellPrint@Cell[BoxData[
- ToBoxes[
- Graphics[{Circle[]}, ImageSize -> {100, Automatic}]
- ]
- ], "Output", CellTags -> "MyGraphic"];
- Print[Button["Diable/Enable Dynamic",
- If[DynamicQ[],
- NotebookLocate["MyCode"];
- code = InputForm @@ MakeExpression@
- First@
- First@Cases[NotebookGet[EvaluationNotebook[]][[1]],
- Cell[___, CellTags -> "MyGraphic", ___], Infinity];
- NotebookWrite[EvaluationNotebook[], Cell[BoxData[
- ToBoxes[code]
- ], "Input", CellTags -> "MyCode"]
- ];,
- NotebookLocate["MyCode"];
- NotebookWrite[EvaluationNotebook[], GetCode[]];
- ];
- ] Button["Update Graphics",
- Print["test"];
- ]
- ];
- CellPrint@GetCode[];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement