Dear all,
I am trying to access ctk.ctkCollapsibleButton, I tried different things but nothing works. The goal is to creating/editing/removing objects during the loading function of the python plugin. Here is something I tried:
class myPluginWidget(ScriptedLoadableModuleWidget):
def setup(self):
print("=======================================================")
print(" myPlugin Title ")
print("=======================================================")
ScriptedLoadableModuleWidget.setup(self)
self.initMainPanel()
def initMainPanel(self):
print(" initMainPanel ")
self.mainClpsBtn = ctk.ctkCollapsibleButton()
self.mainClpsBtn.text = "my Plugin Title"
self.layout.addWidget(self.mainClpsBtn)
self.mainFormLayout = qt.QFormLayout(self.mainClpsBtn)
self.pEDt= qt.QLineEdit()
self.pEDt.setText("some Text")
self.mainFormLayout.addRow( self.pEDt )
self.runBtn = qt.QPushButton("Run")
self.mainFormLayout.addRow(self.runBtn)
items = (self.mainFormLayout.itemAt(i) for i in range(self.mainFormLayout.count()))
print(items)
for w in items:
print(w.widget())
The output is
None
None
I tried:
print(w)
The out put is:
<generator object <genexpr> at 0x7fa27003f690>
QLayoutItem (C++ Object 0x6877ee0)
QLayoutItem (C++ Object 0x68f3270)
Same happened when I replaced self.mainFormLayout with self.layout. How can I get the type of the widget example QLineEdit or QPushButton and access their properties?