Hi Hugo,

You should look at the QLineEdit Class reference docs to find the
method that suits you best, but you could, for example, use the text()
method to get the text contents of your widget.

http://doc.qt.nokia.com/latest/qlineedit.html#text-prop

As for when/how to access that method, you'll probably want to use
signals/slots to choose when you want to trigger a certain action.

Quick example:

import nuke
import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui
from nukescripts import panels

class NukeTestWindow(QtGui.QWidget):
   def __init__(self, parent=None):
       QtGui.QWidget.__init__(self, parent)
       self.setLayout( QtGui.QVBoxLayout() )
       self.myLineEdit = QtGui.QLineEdit("Hello World")
       self.layout().addWidget( self.myLineEdit )
       QtCore.QObject.connect(self.myLineEdit,
QtCore.SIGNAL("returnPressed()"), self.lineEditCB)

   def lineEditCB(self):
       nuke.message("%s" % self.myLineEdit.text())


Is that where you were after?

Cheers,
Ivan


On Fri, Aug 26, 2011 at 12:51 PM, Hugo Léveillé <[email protected]> wrote:
> Hey
>
> Just started using docked pyqt panel inside nuke. Quick question.
>
> Let say I make this very simple panel with a single line edit
>
> =====
>
> import nuke
> import PyQt4.QtCore as QtCore
> import PyQt4.QtGui as QtGui
> from nukescripts import panels
>
> class NukeTestWindow(QtGui.QWidget):
>    def __init__(self, parent=None):
>        QtGui.QWidget.__init__(self, parent)
>        self.setLayout( QtGui.QVBoxLayout() )
>        self.myLineEdit = QtGui.QLineEdit("Hello World")
>        self.layout().addWidget( self.myLineEdit )
>
>
>
> panels.registerWidgetAsPanel('NukeTestWindow', 'Test table panel',
> 'uk.co.thefoundry.NukeTestWindow' )
>
>
> ===========
>
> Once the panel is created, how can I have access to the value of the
> line edit ? The goal would be to make some action inside nuke based on
> the current value of a knob inside that panel
>
> Thanks
>
>
> --
>  Hugo Léveillé
>  TD Compositing, Vision Globale
>  [email protected]
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to