wPython in Action: example chapter 1

7stud bbxx789_05ss at yahoo.com
Fri Apr 20 04:06:45 PDT 2007


Can anyone tell me why this doesn't work:

---
import wx

class MyFrame(wx.Frame):
    def __init__(self, img):
        bmap = img.ConvertToBitmap()
        bmap_size = bmap.GetWidth(), bmap.GetHeight()

        wx.Frame.__init__(self, None, size=bmap_size)

        my_component = wx.StaticBitmap(self, bmap)
        self.SetClientSize(bmap_size)
         
         
class MyApp(wx.App):
    def __init__(self, fname):
        self.fname = fname
        wx.App.__init__(self)

    def OnInit(self):
        img = wx.Image(self.fname, wx.BITMAP_TYPE_JPEG)
        frame = MyFrame(img)
        frame.Show()
        return True

app = MyApp("wxPython.jpg")
app.MainLoop()
----

I find it perplexing that the authors introduce a function called 
ConvertToBitmap() in the first chapter, yet when I look in the index, 
there is no information on it, and when I look in the chapter dedicated to 
"Manipulating basic graphical images" in the subsection titled
 "Creating bitmap objects", there is no mention of the function.  
The function wx.StaticBitmap() in the example is nowhere to be found in the
index either, nor is it in the chapter "Manipulating basic graphical images", 
subsection "Creating bitmap objects" where you might expect to find such a
description. To me that seems like a curious way to write a book: introduce
two function in an introductory example and never explain 
what they do or how to use them.

Is there wxPython documentation somewhere where I can look up a
function name and get the signature and a description of the parameters?

Thanks






More information about the wxpython-users mailing list