

The above simply closes the window but keeps the object alive. nnect(self.customWin, SIGNAL("closed()"), self.OnCustomWinClosed) Self.customWin= CustomWindow(self.factorsFile) How can I instantiate an object and then destroy it after closing the window? At the moment this is the only code which doesn't crash but it's still not what I'm looking for: class MainWindow(QMainWindow): Well, this and show()/close() still crashes it as they only close the window but they don't destroy the actual object.

If you can supply a simple example of what you want to do it would help as you may want to use setModal or closeEvent. nnect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()))

To destroy the object, assign something else to the variable. nnect(slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) Slider = qt.QSlider(qt.Qt.Horizontal, self, "slider") tFont(qt.QFont("Times", 18, qt.QFont.Bold)) Quit = qt.QPushButton("Quit", self, "quit") import sysĭef _init_(self, parent=None, name=None): Most of the tutorials for qt3 (if that is what you are using), use sys.exit(). This will work with bundle_files as well, but you need to exclude the Qt DLLs from bundle (using the dll_excludes option) and add them to the directory with the executable through some other mechanism (such as data_files).What's the Python function/method/whatever to destroy an object? If the plugins are not reachable, then QPixmap.load/loadFromData will return False when loading an image in those formats. Like in the above cases, you can use data_files for this. PyQt4 uses plugins to read those image formats, so you'll need to copy the folder PyQt4\plugins\imageformats to \imageformats. 'C:\Python26\Lib\site-packages\PyQt4\plugins\phonon_backend\phonon_ds94.dll' Otherwise you get an error: "phonon backend could not be loaded"īut the correct way to do this is to use data_files in your setup.py data_files = [ In a similar manner as using PyQt4 and SQlite (from pyqt), one need to add an extra step to use Phonon and copy PyQt4\plugins\phonon_backend directory into your dist directory. A separate copy of sqlite3.dll is not needed.For SQLite I only needed to copy qsqlite4.dll. It did not work for me in any subdirectory including the zipfile directory. QtSql' to the setup includes.Ĭopy the contents of PyQt4\plugins\sqldrivers to \sqldrivers. When deploying applications which use PyQt4 and SQLite:Īdd " PyQt4. 1 from re import setup 2 import py2exe 3 4 setup( windows=[)
