Rosenio
Rosenio
About Me
Connect
LOCATION
Not Specified
ウェブサイト
Houdini Engine
Availability
Not Specified
Recent Forum Posts
Houdini Crashes with PyQt and jpeg image 2013年3月28日13:23
Hi,
I'm developing some tools for Houdini, and I wonder if some of you guys are facing problems with pyqt and jpeg image inside Houdini. It works with png image.
from PyQt4 import QtCore
from PyQt4 import QtGui
import pyqt_houdini
class FontDialog(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
hbox = QtGui.QHBoxLayout()
self.setGeometry(500, 300, 250, 110)
self.setWindowTitle('FontDialog')
button = QtGui.QPushButton('Change Font…', self)
button.setFocusPolicy(QtCore.Qt.NoFocus)
button.move(20, 20)
hbox.addWidget(button)
self.connect(button, QtCore.SIGNAL('clicked()'), self.showDialog)
self.label = QtGui.QLabel('This is some Sample Text', self)
self.label.move(130, 20)
pixmap = QtGui.QPixmap(“/home/username/Desktop/Firefox.jpg”)#Problem here
lbl = QtGui.QLabel(self)
lbl.setPixmap(pixmap)
hbox.addWidget(lbl)
hbox.addWidget(self.label, 1)
self.setLayout(hbox)
def showDialog(self):
font, ok = QtGui.QFontDialog.getFont()
if ok:
self.label.setFont(font)
app = QtGui.QApplication.instance()
if app is None:
app = QtGui.QApplication()
dialog = FontDialog()
dialog.show()
# The main difference from a normal PyQt application is that instead of calling
# app.exec_() you call pyqt_houdini.exec_(app, dialog1, …).
pyqt_houdini.exec_(app, dialog)
Thanks you all.
I'm developing some tools for Houdini, and I wonder if some of you guys are facing problems with pyqt and jpeg image inside Houdini. It works with png image.
from PyQt4 import QtCore
from PyQt4 import QtGui
import pyqt_houdini
class FontDialog(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
hbox = QtGui.QHBoxLayout()
self.setGeometry(500, 300, 250, 110)
self.setWindowTitle('FontDialog')
button = QtGui.QPushButton('Change Font…', self)
button.setFocusPolicy(QtCore.Qt.NoFocus)
button.move(20, 20)
hbox.addWidget(button)
self.connect(button, QtCore.SIGNAL('clicked()'), self.showDialog)
self.label = QtGui.QLabel('This is some Sample Text', self)
self.label.move(130, 20)
pixmap = QtGui.QPixmap(“/home/username/Desktop/Firefox.jpg”)#Problem here
lbl = QtGui.QLabel(self)
lbl.setPixmap(pixmap)
hbox.addWidget(lbl)
hbox.addWidget(self.label, 1)
self.setLayout(hbox)
def showDialog(self):
font, ok = QtGui.QFontDialog.getFont()
if ok:
self.label.setFont(font)
app = QtGui.QApplication.instance()
if app is None:
app = QtGui.QApplication()
dialog = FontDialog()
dialog.show()
# The main difference from a normal PyQt application is that instead of calling
# app.exec_() you call pyqt_houdini.exec_(app, dialog1, …).
pyqt_houdini.exec_(app, dialog)
Thanks you all.