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$ Commented Dec 19, 2012 at 18:35
  • 1
    $\begingroup$ The problem here is pretty much the same as in Computing the bounding boxes for Text objects. $\endgroup$
    – Jens
    Commented Dec 19, 2012 at 18:43

1 Answer 1

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
    Commented Dec 19, 2012 at 18:48
  • $\begingroup$ @santhosh I don't think so. Look at the picture above. $\endgroup$
    – VLC
    Commented Dec 19, 2012 at 18:54

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.