Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42127

Embed vtk window in a QTabWidget

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'messages.': 0.05; 'assign': 0.07; 'sys': 0.07; '__name__': 0.09; 'here?': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'def': 0.12; "'__main__':": 0.16; 'hi:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:q 30': 0.16; 'tabs': 0.16; 'app': 0.19; 'trying': 0.19; 'thanks.': 0.20; 'import': 0.22; 'header:User-Agent:1': 0.23; 'received:comcast.net': 0.24; 'skip:v 30': 0.26; 'post': 0.26; 'header:X-Complaints-To:1': 0.27; 'gives': 0.31; 'embed': 0.31; 'skip:q 20': 0.31; 'class': 0.32; 'skip:c 30': 0.32; 'running': 0.33; 'skip:# 10': 0.33; 'skip:_ 10': 0.34; 'skip:s 30': 0.35; 'but': 0.35; 'add': 0.35; 'area': 0.37; 'somebody': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'first': 0.61; 'email addr:gmail.com': 0.63; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Kene Meniru <Kene.Meniru@illom.org>
Subject Embed vtk window in a QTabWidget
Followup-To gmane.comp.python.general
Date Thu, 28 Mar 2013 09:49:06 -0400
Organization illom.org
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host c-68-49-243-100.hsd1.md.comcast.net
User-Agent KNode/4.4.7
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To Kene.Meniru@illom.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3875.1364478564.2939.python-list@python.org> (permalink)
Lines 76
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364478564 news.xs4all.nl 6927 [2001:888:2000:d::a6]:42219
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:42127

Followups directed to: gmane.comp.python.general

Show key headers only | View raw


Hi: 

I know this may not be the right place to post this but I found some other 
PyQt questions and I am desperate. 

My app is the Window class object below and I am trying to embed a 
QVTKRenderWindowInteractor class called ConeWindow in its QTabWidget. First 
of all running ConeWindow gives out QPainter::begin:, QPainter::save:, 
QPainter::setClipRegion:, and QPainter::restore: messages. This may be what 
is crashing the Window class when I embed it.

Can somebody help me here? Thanks.

-------------------
#!/usr/bin/env python
from PyQt4 import QtGui, QtCore
import vtk
from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
import sys


class Window(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)
        self.treeArea = QtGui.QTreeWidget()
        self.textArea = QtGui.QTextEdit()
        self.viewArea = QtGui.QTabWidget()
        self.msgArea = QtGui.QTextBrowser()
        # Add tabs
        self.modelTab = ConeWindow(self)
        #self.modelTab = QtGui.QTextBrowser()
        self.reportTab = QtGui.QTextBrowser()
        self.viewArea.addTab(self.modelTab, "Model")
        self.viewArea.addTab(self.reportTab, "Report")
        # Window area splitters
        self.vSplitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        self.vSplitter.addWidget(self.viewArea)
        self.vSplitter.addWidget(self.msgArea)
        self.hSplitter = QtGui.QSplitter(QtCore.Qt.Horizontal)
        self.hSplitter.addWidget(self.treeArea)
        self.hSplitter.addWidget(self.textArea)
        self.hSplitter.addWidget(self.vSplitter)
        # Assign mainwindow
        self.setCentralWidget(self.hSplitter)


class ConeWindow(QVTKRenderWindowInteractor):
    def __init__(self, parent=None):
        QVTKRenderWindowInteractor.__init__(self, parent)
        self._parent = parent
        self.vrenderer = vtk.vtkRenderer()
        self.renderWindow = self.GetRenderWindow()
        self.renderWindow.AddRenderer(self.vrenderer)
        self.iren = self.renderWindow.GetInteractor()
        #
        self.cone = vtk.vtkConeSource()
        self.cone.SetResolution(8)
        self.coneMapper = vtk.vtkPolyDataMapper()
        self.coneMapper.SetInput(self.cone.GetOutput())
        self.coneActor = vtk.vtkActor()
        self.coneActor.SetMapper(self.coneMapper)
        self.vrenderer.AddActor(self.coneActor)
        self.iren.Initialize()

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    widge = Window()
    widge.show()
    sys.exit(app.exec_())

-- 

Kene
::::::::::::::::::
KeMeniru@gmail.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Embed vtk window in a QTabWidget Kene Meniru <Kene.Meniru@illom.org> - 2013-03-28 09:49 -0400

csiph-web