~toolpart/+junk/pythoncard

« back to all changes in this revision

Viewing changes to samples/financial/mortgage.py

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi
  • Date: 2010-03-04 23:55:10 UTC
  • mfrom: (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100304235510-3v6lbhzwrgm0pcca
Tags: 0.8.2-1
* QA upload.
* New upstream release
* debian/control
  - set maintainer to QA group
  - set Homepage field, removing the URL from packages description
  - bump versioned b-d-i on python-support, to properly support Python module
  - replace b-d on python-all-dev with python-all, since building only
    arch:all packages
  - replace Source-Version substvar with source:Version
  - add ${misc:Depends} to binary packages Depends
* debian/watch
  - updated to use the SourceForge redirector; thanks to Raphael Geissert for
    the report and to Dario Minnucci for the patch; Closes: #449904
* debian/{pythoncard-doc, python-pythoncard}.install
  - use wildcards instead of site-packages to fix build with python 2.6;
    thanks to Ilya Barygin for the report and patch; Closes: #572332
* debian/pythoncard-doc.doc-base
  - set section to Programmin/Python
* debian/pythoncard-tools.menu
  - set menu main section to Applications
* debian/pythoncard-tools.postinst
  - removed, needed only to update the menu, but it's now created by debhelper

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
"""
4
 
__version__ = "$Revision: 1.1 $"
5
 
__date__ = "$Date: 2004/07/20 18:22:35 $"
 
4
A mortgage repayment calculator. Used in the presentation at VanPy 2005 and PyCon 2005.
 
5
 
 
6
Subsequently borrowed for the presentation at OSDC 2005 
6
7
"""
 
8
__version__ = "$Revision: 1.2 $"
 
9
__date__ = "$Date: 2005/12/13 11:13:22 $"
7
10
 
8
11
from PythonCard import dialog, model
9
12
import pyfi
10
13
 
11
 
class MyBackground(model.Background):
 
14
class MyBackground(model.Background)
12
15
 
13
16
    def on_initialize(self, event):
14
17
        # if you have any initialization
25
28
            payment15 = pyfi.amortization(principal, interestRate, 12, 15 * 12)
26
29
            payment30 = pyfi.amortization(principal, interestRate, 12, 30 * 12)
27
30
            comp.Result.text = "15 year monthly payment: %.2f\n30 year monthly payment: %.2f" % (payment15, payment30)
28
 
        except:
 
31
        except ValueError:
29
32
            dialog.alertDialog(self, 'Please enter valid values', 'Input Value(s) Error')
30
33
 
31
 
 
32
34
if __name__ == '__main__':
33
35
    app = model.Application(MyBackground)
34
36
    app.MainLoop()