Many thanks Nathan. That was exactly what I was looking for.

I'm just wondering... I was looking through the API docs, but I had a hard time 
finding anything that could lead me up to calling the customKnob (although I 
now find it when doing a search on that website).

Where do you go to look up stuff like this?
Are you using the API documentation?

Regards,
Fredrik





> On Mon, Oct 7, 2013 at 5:05 AM, Nathan Rusch <nathan_ru...@hotmail.com> wrote:
> `registerWidgetAsPanel()` returns a PythonPanel instance when create=True 
> (its `.addToPane()` method also returns a reference to itself), and the panel 
> has a PyCustom_Knob stored in an attribute called `customKnob`. The 
> PyCustom_Knob class then has a `.getObject()` method, which returns a simple 
> holder for the actual Qt object instance (stored in a `widget` attribute).
>  
> So, to get from the registered panel to the Qt object, use:
>  
> panel = panels.registerWidgetAsPanel(name, title, identifier, 
> create=True).addToPane(pane)
> gui = panel.customKnob.getObject().widget
>  
>  
> -Nathan
> 
>  
> From: Fredrik Averpil
> Sent: Sunday, October 06, 2013 4:48 AM
> To: Nuke Python discussion
> Subject: [Nuke-python] How to access UI elements from panel?
>  
> Hi,
>  
> I am having issues with accessing UI elements when having created a panel in 
> a script which creates both regular windows and panels.
>  
> I need to access the UI elements, from both windows and panels, like this: 
> gui.listWidget.addItem('hello')
> ...and that works perfectly fine if I create a regular floating window 
> (dockedWindow = False), but I can't make it to work when I create panels 
> (dockedWindow = True).
>  
> Any ideas?
>  
>  
> 
> class HelloWorld(form, base):
> def __init__(self, parent=None):
> super(HelloWorld, self).__init__(parent)
> # 
> ...
> 
> def run():
> dockedWindow = True
> 
> if dockedWindow:
> pane = nuke.getPaneFor('Properties.1')
> global gui
> gui = panels.registerWidgetAsPanel( moduleName + 'HelloWorld' , windowTitle, 
> ('uk.co.thefoundry.'+windowObject+'Window'), True).addToPane(pane)
> else:
> global gui
> gui = HelloWorld()
> gui.show()
> 
>  
>  
> Regards,
> Fredrik
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
> 
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to