# How to show a general graphic (not a Plot) inside a Manipulate

I'm building a little interface, which consists only of a button, as you can see here:

Button["File Input",
Print[principalFunction[file]]]


Now I'd like to insert the produced graphic and the button inside a Manipulate. Note that I'm not using Plot, Plot3D, etc. -- the graphics are produced by principalFunction as the final result of evaluating many other functions.

• Instead of an image give us the code? Adapt it so we don't need the file? :) Or you can just provide the file as well. – Öskå Apr 24 '14 at 13:54
• ok, I've done what you asked – Lory Lory Apr 24 '14 at 14:03
• Try Module[{file = {0, 0}}, Panel[Column@{Button["File Input", file = ToExpression@Import[SystemDialogInput["FileOpen"], "Data"];], Dynamic@ListLinePlot@file}]]. The important parts here are Module, Panel (for the Manipulate-lookalike) and Dynamic for the update :) Works with a text file containing {{1,0},{1,1}}. – Öskå Apr 24 '14 at 14:12

Not really a fancy answer but questions need to be answered and I hope this answers the (quite unclear) question.

As mentioned in the comments the important parts in the following codes are Module, Panel for the Manipulate lookalike and Dynamic for the update. Since you mentioned that you were not using Plot here is an example with a Graphic entity.

Module[{file = {{0, 0}}, r = 1},
Panel[Column@{
Button["File Input",file = ToExpression@
Dynamic@Graphics[Disk[#, r] & /@ file]}]]


In your case you would have principalFunction@file instead of Graphics[Disk[#, r] & /@ file] and file = Import[SystemDialogInput["FileOpen"]]; with the operations (such as ToExpression in my case) you need to in order to use your data after using Import.

Version with Manipulate (thus no Dynamic nor Panel):

Module[{file = {{0, 0}}, r = 1},
Manipulate[Graphics[Disk[#, r] & /@ file, ImageSize -> {200, 200}],
Button["File Input", file =