3
$\begingroup$

I'm using a TogglerBar with a set of images, but I can't figure out how to get it to respect the size of the images:

images = Table[ExampleData[{"TestImage", "Mandrill"}], 15];

DynamicModule[{c = {}},
  Dynamic[TogglerBar[Dynamic[c], Thread[Range[Length[images]] -> 
    (ImageResize[#, 300] & /@ images)], Appearance -> "Row"]]]

Here the images are much smaller than 300. If I use Show with a fixed ImageSize, it does respect that, but is there a better way to get the TogglerBar not to resize things?

$\endgroup$
4
$\begingroup$

Add the option BaseStyle -> ImageSizeMultipliers -> 1 to TogglerBar:

DynamicModule[{c = {}}, Dynamic[TogglerBar[Dynamic[c], 
  Thread[Range[Length[images]] -> (ImageResize[#, 300] & /@ images)],
     Appearance -> "Row", BaseStyle -> ImageSizeMultipliers -> 1]]]
$\endgroup$
  • 1
    $\begingroup$ Thank you. The help page for BaseStyle was useless. $\endgroup$ – KraZug Nov 9 '18 at 13:29

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.