[wxPython] [wxPython 2.3.1] Best way to fill bitmap within rectangle (or whatever)

Hello wxPython users,

I'm developing an application with a basic printing & previewing
facility by using wxPrintPreview, wxPrintout etc.

I'm trying to find out a way to fill a rectangle object with a selected
bitmap file within a DC. Initially I was trying to achieve this by
using wxBrush and its SetStipple function like:

dc.BeginDrawing()

wxInitAllImageHandlers()
bmp_file = wxImage('fill.png', wxBITMAP_TYPE_PNG)
bmp = bmp_file.ConvertToBitmap()
brush = wxBrush(wxNamedColour("BLACK")
brush.SetStipple(bmp)
dc.SetBrush(brush)
dc.DrawRectangle(10, 10, 200, 200)

dc.EndDrawing()

This seemed to work okay at first. But in preview screen the size of
the image won't change even when the zoom changes. Also, the image gets
printed in different size depending upon the printer resolution i.e. a
300 dpi printer prints the image larger than a 600 dpi printer does.

What would be the best way to fill a rectangular area with an image and
make the image size consistent across printers of different dpis and
different zoome rate in preview screen?

Any help/hint would be appreciated.

Kohei Yoshida

brush = wxBrush(wxNamedColour("BLACK")

I mean, brush = wxBrush(wxNamedColour("BLACK"))

Kohei