1
$\begingroup$

I have created a panel, say Panel[""]. I want to know its size/dimensions. Is there any built-in function for doing that?

$\endgroup$
2
  • 1
    $\begingroup$ Do you want to interpret a Panel object as an image? It is not a good idea because Panel is a kind of dynamic expression in Mathematica. Only "static" objects have dimensions and size (for example, Image). $\endgroup$ – Piotr Semenov Dec 19 '12 at 18:35
  • 1
    $\begingroup$ The problem here is pretty much the same as in Computing the bounding boxes for Text objects. $\endgroup$ – Jens Dec 19 '12 at 18:43
2
$\begingroup$

You could get the size of the rasterized panel:

Rasterize[Panel[""]][[2]]

ImageSize -> {18, 33}

Rasterize[Panel["What is my size?"]][[2]]

ImageSize -> {97, 33}

enter image description here

$\endgroup$
2
  • $\begingroup$ Does this operation Resize the actual panel ? $\endgroup$ – santhosh Dec 19 '12 at 18:48
  • $\begingroup$ @santhosh I don't think so. Look at the picture above. $\endgroup$ – VLC Dec 19 '12 at 18:54

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.