an Image

Peter Hansen peter at engcorp.com
Tue Jul 27 17:12:40 EDT 2004


JDevine wrote:

> I am going through the painfull process of learning wxPython.  Sincer
> there is nearly no documentation, I am learning from the demos. 
> Unfortunately, I have realized these demos do some specialized
> importing and that all the imports are not applicable.  Specifially,
> All I want to do now is insert a bmp I have drawn into a windows
> application.  The image clases from the demos are completely
> unexplanatory about how to do this.  The "images" module that is
> imported has custom functions for calling a specific set of images
> such as GetTest2Bitmap, which does not help me at all.  Please help me
> understand this.

I don't know what part of the demo you are looking at, but the
one I have has some real simple code under "Using Images->Image"
that looks like this (irrelevant parts removed for simplicity):

import  wx

def runTest(frame, nb, log):
     bmp = wx.Image('bitmaps/image.bmp',
         wx.BITMAP_TYPE_BMP).ConvertToBitmap()

     panel = wx.Panel(nb, -1)

     pos = 10
     wx.StaticBitmap(panel, -1, bmp, (10, pos),
         (bmp.GetWidth(), bmp.GetHeight()))


Can't get much simpler than that...   are you remembering to
look under the "Demo Code" tab of the demo, where the source
code is shown?  It almost sounds like you are digging through
the source files manually, rather than using the demo the way
it was intended.

-Peter



More information about the Python-list mailing list