3
$\begingroup$

How can a small square button be created with ImageSize -> {20,20}?

The x-dimension won't go below about 70.

(Using version 9.0.1 on OS X.)

Grid[{
  {Button["", ImageSize -> {10, 10}],
   Button["", ImageSize -> {20, 20}]},
  {Button["", ImageSize -> {30, 30}],
   Button["", ImageSize -> {90, 30}]}},
 Frame -> All, Alignment -> Left]

enter image description here

$\endgroup$
  • $\begingroup$ Works fine for me W7 MMA 8.0. $\endgroup$ – Öskå Aug 18 '13 at 10:31
  • $\begingroup$ Win 7 V9.0 looks also Ok. $\endgroup$ – Kuba Aug 18 '13 at 10:38
  • $\begingroup$ Thanks. I recall this working ok on Windows. $\endgroup$ – Chris Degnen Aug 18 '13 at 10:39
  • $\begingroup$ Works fine on Linux 8.0 too. $\endgroup$ – Öskå Aug 18 '13 at 10:41
5
$\begingroup$

The problem is that on OS X the default appearance "style button" has a minimum size. Note below that Appearance has to be set locally within each button rather than in the Style wrapper.

Style[
 Grid[{{
    Button["x", Null, Appearance -> None, ImageSize -> {10, 10}],
    Button["x", Null, Appearance -> None, ImageSize -> {20, 20}]},
   {Button["x", Null, Appearance -> None, ImageSize -> {30, 30}],
    Button["x", Null, Appearance -> None, ImageSize -> {90, 30}]}},
  Frame -> All,
  ItemSize -> All,
  Alignment -> Left],
 DefaultOptions -> {
   Button -> {
     Background -> Orange,
     BaseStyle -> Directive[FontColor -> Black, 11]
     }
   }]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks. Appearance -> "Palette" is a palatable solution. $\endgroup$ – Chris Degnen Aug 18 '13 at 11:09

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.