Why does wxStaticBitmap display multiple images instead of one [Newbie alert]

Knoppix User knoppix at laptop.home.net
Tue Dec 30 19:44:31 EST 2003


Hi everyone

I am working on a small app that loads a directory into a list, using 

        dirList = os.listdir(dirName)

The idea is that it then traverses the list, storing each filename in
curFile, and appending the directory:

        curFile = dirName + '/' + dirList[dirListndx]

The image then is displayed using a call:

        self.showJpg(curFile)

to the function showJpg:

    def showJpg(self, fName):
    #Display jpg to app
        img = wxImage(fName, wxBITMAP_TYPE_JPEG)
        imgSmall = img.Scale(200,200)
        wxStaticBitmap(self, -1, wxBitmapFromImage(imgSmall), pos = (245, 60),
	 size= (100,100))

All works as planned, except that the image displayed, being correct,
first shows, in rapid succession, each of the prior showed images before
it halts at the appropriate curFile. 

I have tried to debug it in BoaConstructor, and the inputs to showJpg are
appropriate. Am I using wxStaticBitmap incorrectly? Do I need to
initialize wxStaticBitmap, and if so, how?

Any help is much appreciated.

Steve




More information about the Python-list mailing list