[PyQt] QGraphicsView.setBackgroundBrush don't work
leo kirotawa
kirotawa at gmail.com
Sat Oct 23 18:24:04 BST 2010
thanks for you help
Now it work fine, was just the image path, but what is curious that it dont
work begore, very strange.
[]'s
On Sat, Oct 23, 2010 at 5:00 AM, Vincent Vande Vyvre <
vincent.vandevyvre at swing.be> wrote:
> Le 23/10/10 09:09, leo kirotawa a écrit :
>
> Hi,
>
> I have the piece of code
>
>
> view = QtGui.QGraphicsView(scene)
>
> view.setRenderHint(QtGui.QPainter.Antialiasing)
> view.setRenderHint(QtGui.QPainter.Antialiasing)
> pixmap = QtGui.QImage(":/images/background.jpg")
>
> view.setBackgroundBrush(QtGui.QBrush(pixmap))
> view.setCacheMode(QtGui.QGraphicsView.CacheBackground)
>
> So my scene have 800 x 600 pixel, and my image too. When I try put the
> background in view just show a view in white color with no image. What I 'm
> doing wrong?
> --
> Leônidas S. Barbosa (Kirotawa)
> [DesenvolvedorWeb/CEFET/RN]
> [Ciências da Computação/UFRN]
> [pós-graduando em Inteligência Computacional/Processamento Gráfico /UFRN
> [Estudante de japonês nível Intermediário I - Japanese Student]
> [Desenvolvedor em python, PyGame]
> blog nerd: corecode.wordpress.com/
> blog music: essenaomanja.blogspot.com
> blog tirinhas: elminiche.wordpress.com/
>
> "Mais sábio é aquele que sabe que não sabe" (Sócrates)
>
> 日本語の学生です。
> コンピュータサイエンスの学位.
>
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.comhttp://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
> Hi,
>
> I have reproduce your code like this:
>
> class GraphicView(object):
> def __init__(self, MainWindow):
> MainWindow.resize(864, 649)
> self.centralwidget = QtGui.QWidget(MainWindow)
> self.gridLayout = QtGui.QGridLayout(self.centralwidget)
> self.scene = QtGui.QGraphicsScene(self.centralwidget)
> self.graphicsView = QtGui.QGraphicsView(self.scene)
> self.graphicsView.setRenderHints(QtGui.QPainter.Antialiasing)
> pixmap = QtGui.QImage("amymc1.jpg")
> self.graphicsView.setBackgroundBrush(QtGui.QBrush(pixmap))
> self.graphicsView.setCacheMode(QtGui.QGraphicsView.CacheBackground)
> self.gridLayout.addWidget(self.graphicsView, 0, 0, 1, 1)
> MainWindow.setCentralWidget(self.centralwidget)
>
> On Qt 4.6, PyQt 4.7.2
> and Qt 4.7, PyQt 4.7.4
>
> That functions but the result is unexpected.(See attachement)
>
> --
> Vincent V.V.
> Oqapy <https://launchpad.net/oqapy>
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
--
Leônidas S. Barbosa (Kirotawa)
[DesenvolvedorWeb/CEFET/RN]
[Ciências da Computação/UFRN]
[pós-graduando em Inteligência Computacional/Processamento Gráfico /UFRN
[Estudante de japonês nível Intermediário I - Japanese Student]
[Desenvolvedor em python, PyGame]
blog nerd: corecode.wordpress.com/
blog music: essenaomanja.blogspot.com
blog tirinhas: elminiche.wordpress.com/
"Mais sábio é aquele que sabe que não sabe" (Sócrates)
日本語の学生です。
コンピュータサイエンスの学位.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101023/713d03d3/attachment.html>
More information about the PyQt
mailing list