0
$\begingroup$

I looked around the documentation, but didn't found anything that could help me add a picture in a dialogbox. I actually didn't know what should I have been looking for. Furthermore, if it is possible to add pictures in dialog boxes, I suspect that I should use a path file to that image, but I wish to use my mathematica program in any pc, so how can I have that image in my dialog box, regardless of where I use the code. Thank you

$\endgroup$
  • $\begingroup$ Meanwhile, I found out that I might use the Import function but I still have the problem of using the image in any pc $\endgroup$ – RicardoP Aug 22 '17 at 11:06
  • $\begingroup$ ico = ImageResize[ExampleData[{"TestImage", "Clock"}], Scaled[{1/8, 1/8}]]; CreateDialog[{ico, TextCell["Enter a name: "], InputField[Dynamic[nm], String], DefaultButton[DialogReturn[ret = nm]]}]; gives this. If you're asking about how to store an imported image in Mathematica for later use, that's a different question altogether. $\endgroup$ – J. M. will be back soon Aug 22 '17 at 11:14
  • $\begingroup$ Thank you for the answer! What is the difference between using the code you have shown and importing the image? If i import the image in mathematica for later use (which I think is what I want if I want to use my code in other devices) do I still have to specify the path file? $\endgroup$ – RicardoP Aug 22 '17 at 11:48
  • $\begingroup$ Direct embedding ought to work. $\endgroup$ – J. M. will be back soon Aug 22 '17 at 12:05
  • $\begingroup$ You mean directly "copy and paste" the image in the notebook? If yes, it worked, thank you very much! $\endgroup$ – RicardoP Aug 22 '17 at 16:48
1
$\begingroup$

A "dialog box" is just another notebook. It can contain and display anything that can be displayed in a notebook.

When you Import an image, you get a little picture as the output. Just use this as-is. Do you already know how to show text in a dialog? Just copy and paste this image in place of that text in your code.

$\endgroup$

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.