Estoy usando Python 3.2, PyQt 4.8
S.O: Windows 7 x64
Y según estuve investigando para hacer esto se usa py2exe , pero funciona bien parece hasta python 3.1, intente hacerlo andar y NADA.
Así que encontre cx_Freeze ([URL="http://cx-freeze.sourceforge.net/cx_Freeze.html"]http://cx-freeze.sourceforge.net/cx_Freeze.html[/URL]).
Logré crear el Ejecutable .EXE pero cuando lo abro me tira que QSql Database: QMYSQL driver not loaded.
Armé uno de prueba para que vean aver si se les ocurre:
Código:
import sys
from PyQt4 import QtCore, QtGui, QtSql
from test_para_instalar_vista import Ui_ventana_principal_vista
class Principal (QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ventana = Ui_ventana_principal_vista()
self.ventana.setupUi(self)
self.ventana.data_base = QtSql.QSqlDatabase.addDatabase('QMYSQL')
self.ventana.data_base.setHostName("poner un ip o dns")
self.ventana.data_base.setDatabaseName("poner database")
self.ventana.data_base.setUserName("poner usuario")
self.ventana.data_base.setPassword("poner contraseña")
self.ventana.data_base.open()
self.ventana.lineEdit_se_conecto_o_no.setText( str (self.ventana.data_base.open()))
if __name__ == '__main__':
#Instancio la aplicacion (necesario para que levante el driver de mysql y todo)
app = QtGui.QApplication(sys.argv)
# detectar_ips()
ventana = Principal()
ventana.show()
sys.exit(app.exec_())
Y la vista:
Código:
El build:# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_ventana_principal_vista(object):
def setupUi(self, ventana_principal_vista):
ventana_principal_vista.setObjectName(_fromUtf8("ventana_principal_vista"))
ventana_principal_vista.resize(682, 477)
ventana_principal_vista.setStyleSheet(_fromUtf8("QWidget {\n"
" background-color: rgb(94, 94, 94);\n"
"}"))
self.centralwidget = QtGui.QWidget(ventana_principal_vista)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.lineEdit_se_conecto_o_no = QtGui.QLineEdit(self.centralwidget)
self.lineEdit_se_conecto_o_no.setGeometry(QtCore.QRect(300, 220, 113, 20))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(True)
font.setWeight(75)
self.lineEdit_se_conecto_o_no.setFont(font)
self.lineEdit_se_conecto_o_no.setObjectName(_fromUtf8("lineEdit_se_conecto_o_no"))
ventana_principal_vista.setCentralWidget(self.centralwidget)
self.retranslateUi(ventana_principal_vista)
QtCore.QMetaObject.connectSlotsByName(ventana_principal_vista)
def retranslateUi(self, ventana_principal_vista):
ventana_principal_vista.setWindowTitle(QtGui.QApplication.translate("ventana_principal_vista", "Ventana Principal de Test Instal", None, QtGui.QApplication.UnicodeUTF8))
Código:
from cx_Freeze import setup, Executable
setup(
name = "hello",
version = "0.1",
description = "the typical 'Hello, world!' script",
executables = [Executable("test_para_instalar.py")])
Y otro problema es que tampoco abre las imagenes del rc
Saludos.-



