[Tutor] Classes in multiple files

Phil phil_lor at bigpond.com
Thu Apr 4 02:22:11 CEST 2013


On 04/04/13 09:32, Alan Gauld wrote:
> On 04/04/13 00:14, Phil wrote:
>
>> If this was C++ then I'd need to include a class header and so I'm
>> thinking that an import statement is needed in the main window class
>> referring to the dialog class. Import SatelliteListDialog isn't correct.
>
> Reme,ber that in python its the file name you need to use to import
>
> So if SatelliteListDialog is defined in satellite.py you need
>
> import satellite
>
> in your main window file.
> And satellite.py has to be in your library path too...
>

That makes sense, much like a header file in C++. I haven't set a 
library path, so I'm using the default, what ever it may be. I'll 
investigate this.

> Then in your main window class you need to access the dialog with
>
>     self.sld = satellite.SatelliteListDialog(...)
>
> or whatever. In other words you need the module name prefix.
>
> If that still doesn't work post some code and any error messages.
>

At the moment I'm a little uncertain how I should proceed from here but 
I'll give it a go.

-- 
Regards,
Phil


More information about the Tutor mailing list