Graphic innovation (was: Migrating to perl?)

Gerhard Häring gerhard.nospam at bigfoot.de
Fri Jan 5 13:00:01 EST 2001


I just happened to use wxPython for something that people normally use
Python Imaging Library. I didn't quite 'get' PIL, and I already knew
wxPython.

There were two button templates (one for selected, one for deselected).
The titles of the webpages were written onto the button templates in a
specified font.

The relevant code was very much like this:

def create( self ):
    wxImage_AddHandler( wxPNGHandler() )

    dc = wxMemoryDC()
    dc.SetFont( self.font )
    if self.infile == None:
        bmp = wxEmptyBitmap( self.width, self.height, self.colordepth )
    else:
        # load button template
        bmp = wxBitmap( self.infile, wxBITMAP_TYPE_PNG )

    # create a drawing context from the bitmap
    dc.SelectObject( bmp )

    # draw text on the button
    dc.DrawText( self.text, 5, 4 )

    # save button to file
    i = wxImageFromBitmap( bmp )
    i.SaveFile( self.outfile, wxBITMAP_TYPE_PNG )


Gerhard Häring

Cameron Laird wrote:

> wxPython generates buttons for Web pages?  I
> don't understand; do you mean you created an
> application which dynamically generates inter-
> esting buttons, which you then "snapshotted"
> to use as HTML IMGs?

Yes, more or less. Except that it was done for static HTML pages once.

-- 
Sorry for the fake email, please use the real one below to reply.
contact: g e r h a r d @ b i g f o o t . d e
web:     http://highqualdev.com



More information about the Python-list mailing list