1
$\begingroup$

Such details are driving me crazy while creating GUIs with Mathematica:

Panel[
  Panel["", Background -> Yellow, ImageMargins -> 0, ImageSize -> {26, 26}]
  , Background -> Black, Alignment -> Center]

enter image description here

Margins above are symmetric in vertical and horizontal direction, let's say I want to take control and specify FrameMargins:

Panel[
  Panel["", Background -> Yellow, ImageMargins -> 0, ImageSize -> {26, 26}]
  , Background -> Black, Alignment -> Center, FrameMargins -> {{1, 1}, {1, 1}}]

enter image description here

Now clearly they are not. I used 1 because then it is easily seen but the value does not matter.

Am I missing something?

Edit

With Framed it seems to be ok, but one have to add FrameStyle->None.

$\endgroup$
  • 1
    $\begingroup$ On OS X, v 9.0.0.0 both examples are symmetric. Perhaps it is a bug with OS/MMA version that you're using. $\endgroup$ – C. E. Jan 13 '14 at 9:25
  • 2
    $\begingroup$ it works ok on windows 7, V 9.01, screen shot: !Mathematica graphics $\endgroup$ – Nasser Jan 13 '14 at 9:42
  • 1
    $\begingroup$ I can reproduce this on Windows 2003. Very strange for this to be OS version-dependent. Same result in versions 8.0.4 and 7.0.1, albeit the asymmetry is less pronounced in the latter (the top margin is slightly thicker). $\endgroup$ – Oleksandr R. Jan 13 '14 at 10:51
  • 1
    $\begingroup$ I saw no problem with the FrameMargins version, when I evaluated it in V.9.0.1 on OS X 10.6.8 $\endgroup$ – m_goldberg Jan 13 '14 at 14:24
  • 1
    $\begingroup$ On Windows 7 x64 in MMa 8.0.4 both examples are symmetric. $\endgroup$ – Alexey Popkov Jan 13 '14 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.