[Paraview] Getting user input while in python shell plugin

m.c.wilkins at massey.ac.nz m.c.wilkins at massey.ac.nz
Wed May 26 18:27:49 EDT 2010


Hi,

On Wed, May 26, 2010 at 11:18:29AM -0400, pat marion wrote:
> If you want to use PyQt4, see
> http://paraview.markmail.org/message/6h767kpak5dcoqwt

Thank you, this is what I needed, good stuff.  The only thing I
couldn't immediately figure out from that post, was what to do with
widgets that need a parent, because I couldn't get hold of the main
paraview window widget.  Anyway this is what I did:

---
import PyQt4.QtGui

# this is a dummy widget to use as the parent for other widgets that need a
parent
wid = PyQt4.QtGui.QWidget()

# get some user input
ret = PyQt4.QtGui.QInputDialog.getText(wid, 'hi', 'first question')

# do some other stuff

# oh dear a warning
ret = PyQt4.QtGui.QMessageBox.warning(wid, 'hi', 'there was a recoverable problem', PyQt4.QtGui.QMessageBox.Ok, PyQt4.QtGui.QMessageBox.NoButton, PyQt4.QtGui.QMessageBox.NoButton) 

# maybe get some more input
ret = PyQt4.QtGui.QInputDialog.getText(wid, 'hi', 'second question')
---


Thanks

Matt




More information about the ParaView mailing list