PLplot: plplotcanvas.py Source File

PLplot 5.10.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plplotcanvas.py
Go to the documentation of this file.
1 """plplotcanvas.py - Python front-end for the plplotcanvas
2
3 Copyright (C) 2004, 2005 Thomas J. Duck
4 All rights reserved.
5
6 Thomas J. Duck <tom.duck@dal.ca>
7 Department of Physics and Atmospheric Science,
8 Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5
9
10
11 NOTICE
12
13 This library is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 2.1 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
26 USA
27 """
28
29
30 import plplot
31 import cplplotcanvas
32 import exceptions
33
34 class Canvas(cplplotcanvas.Canvas):
35
36 def __init__(self):
37 cplplotcanvas.Canvas.__init__(self)
38 self.devinit()
39
40 def __getattr__(self,name):
41
42 # Select the stream
43 Nstream = self.get_stream_number()
44 plplot.plsstrm(Nstream)
45
46 # Try to get the function using all of the available prefixes
47 if 'pl'+name in dir(plplot):
48 return eval('plplot.' + 'pl' + name)
49 elif '' + name in dir(plplot):
50 return eval('plplot.' + '' + name)
51 elif 'pl_' + name in dir(plplot):
52 return eval('plplot.' + 'pl_' + name)
53 else:
54 msg = "'Canvas' object has no attribute '%s'" % (name)
55 raise exceptions.AttributeError, msg