Data access from multiple code modules
- From: simon.hibbs@xxxxxxxxx
- Date: 12 Jul 2006 07:19:23 -0700
Lets say that I have an application consisting of 3 files. A main.py
file, gui.py and a data.py which handles persistent data storage.
Suppose data.py defines a class 'MyDB' which reads in data from a
database, and main.py creates an instance of this object. How does code
in gui.py access this object? Here's simplified pseudocode:
MAIN.PY
import gui, data
DataObject = data.MyDB(blah)
How do I write code in gui.py that can access DataObject? Is this
entirely the wrong way to approach this sort of problem?
Actualy the problem is more complex because the GUI consists of a main
GUI form, and panels defined as seperate objects in seperate files.
Various panels will contain controlls for manipulating data in the
DataObject, or wherever data storage end up.
Best regards,
Simon Hibbs
(who strugles to get his head round this OOP stuff sometimes).
.
- Follow-Ups:
- Re: Data access from multiple code modules
- From: Bruno Desthuilliers
- Re: Data access from multiple code modules
- From: Jeremy Jones
- Re: Data access from multiple code modules
- Prev by Date: Re: wxHtmlHelpController
- Next by Date: Re: Data access from multiple code modules
- Previous by thread: wxHtmlHelpController
- Next by thread: Re: Data access from multiple code modules
- Index(es):
Relevant Pages
|