wx.PyScrolledWindow - How size it to its bitmap size ?

I’m trying to get a wx.PyScrolledWindow to size to its minimum size. That is, when the bitmap is larger than its container’s size then show it clipped with scrollbars. This is is working properly.

However, when its bitmap is smaller than the container the PyScrolledWindow shows its background panel. See the screenshots below. How can I get it to show just just the bitmap without any scrollbars ?

The PyScrolledWindow doc seems to have useful methods but none of them are explained !

Ray Pasco

BitmapLarge.png

BitmapSmall.png

I finally figured it out: The documentation for PyScrolledWindow and ScrolledWindow is seriously in need of correction and very much addition. The method PyScrolledWindow.DoSetSize is named incredibly badly. It actually implements “DoSetRect()” which sets both its position and its size at the same time.

Ray

Why do you need to override DoSetSize? All that should be needed to get the window to show just the image with no scrollbars is to set the virtual size and the client size to be the same as the size of the image you are drawing. If you've got in in a sizer that is sizing it too big then also call SetMinSize and/or change what parameters it is added to the sizer with. If you've got it as the only child in a frame without a sizer then set the client size of the frame to match and/or use a sizer.

BTW, the reason DoSetSize is named that way because *all* other sizing and moving methods call it to do the job.

···

On 7/3/11 4:41 PM, Ray Pasco wrote:

I finally figured it out: The documentation for PyScrolledWindow and
ScrolledWindow is seriously in need of correction and very much
addition. The method PyScrolledWindow.DoSetSize is named incredibly
badly. It actually implements "DoSetRect()" which sets both its position
and its size at the same time.

--
Robin Dunn
Software Craftsman

wx.Rect has separate methods for SetSize and SetPosition. They do exactly what they are named and are independent of each other. Setiing both at the same time is accomplished by creating a new Rect object that requires 4 parameters: (posX, posY, sizeX, sizeY).

Ray