On 04/04/13 09:32, Alan Gauld wrote:
<cut>
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...
The Eric IDE must take care of the path. All I had to do was import the
file containing the dialog class.
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.
I think I must be very close now so I'll post just the code that I think
is relevant.
This the main window class:
from PyQt4.QtGui import QMainWindow
from PyQt4.QtCore import pyqtSignature
from Ui_mainwindow import Ui_MainWindow
from PyQt4 import QtGui
import satListDialog
class MainWindow(QMainWindow, Ui_MainWindow):
This is the function to show the dialog;
def on_actionList_triggered(self):
self.dialog = Ui_satListDialog.SatelliteListDialog()
self.dialog.show()
Finally, this is the dialog class;
from PyQt4.QtGui import QDialog
from PyQt4.QtCore import pyqtSignature
from Ui_satListDialog import Ui_Dialog
class SatelliteListDialog(QDialog, Ui_Dialog):
And this is the error message;
"global name 'Ui_satListDialog' is not defined"
I have tried just about every conceivable combination in the
on_actionList_triggered(self) function but I still end up with a "not
defined" error.
--
Regards,
Phil
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor