an Image

M.E.Farmer mefjr75 at
Thu Jul 29 06:40:29 CEST 2004

justin__devine at (JDevine) wrote in message news:<f9d01b73.0407271254.427a271a at>...
> 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.
> -Thanks
> -Justin
Maybe this will help you.

# SimpleImage ver 1.0
# by M.E.Farmer Jr. 2003
# Utilizes the new wx namespace
# usage: python image.jpg
import sys
import wx 
    frame = wx.Frame(None, -1, "SimpleImage", size=(-1,-1),pos=(1,1))
    # Converts the image into a wx compatible bitmap 
    pix = wx.Image(sys.argv[1], wx.BITMAP_TYPE_ANY).ConvertToBitmap()
    # Now wx.StaticBitmap() can be used to place that bitmap onto the parent 
    st = wx.StaticBitmap(frame, -1, pix, pos=(1,1),
    app = wx.PySimpleApp()

 M.E. Farmer

More information about the Python-list mailing list