a simple graphic library

Chris Barker Chris.Barker at noaa.gov
Tue Aug 27 20:49:07 CEST 2002


polux wrote:
> I'd like commands like point(10,10) or something like this to trace a
> point on the scree like with old langages like BASIC

I"ve put together a package that does that kind of thing. It's probably
overkill for what you need, but has a lot of nifty features:

Arbitrary Floating Point Coordinates
Double Buffered
Zoomable and Scrollable
etc....

It requires wxPython and Numeric

The FloatCanvas module provides a wxPython control that can be imbedded
in a wxPython application. I've also written a small wrapper application
that provides a really easy way to just draw stuff to the screen. All
you need to do is create a draw function that draws what you want, and
overwrite the App's draw function before starting it.

You can get it from:
ftp://home.orr.noaa.gov/FTP_ORR/from_orr/ChrisBarker/DrawApp.zip

Feel free to pepper me with questions...
-Chris

Here's a simple example, there is a longer one in the DrawApp module.

def draw(self):
    Canvas = self.Canvas
    Canvas.AddRectangle(50,35,100,65,FillColor    = "Red")

import DrawApp

## DrawApp.Draw is replaced by the one you just defined above:      
DrawApp.DrawApp.Draw = draw
## DrawApp is started:
DrawApp.DrawApp(0).MainLoop()


-- 
Christopher Barker, Ph.D.
Oceanographer
                                    		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the Python-list mailing list