Python Forum
[PyQt] Get class 's children on init
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Get class 's children on init
#3
Sorry, I meant: children = self.children()
Yes I've tried what you suggest, it also fails.

Maybe I should get the children not in init but in some other function (I wonder which one?) because they, may, have not yet been created?


This class 'promotes' a QGroupBox to 'DataForm', maybe my constructor is incorrect?
DataForm(QtGui.QGroupBox):

   def __init__, parent):
       QtGui.QGroupBox.__init__(self, parent)
I tried in showEvent, now it works BUT brings ALL the widgets of the form!!! and not only the ones in my widget (my GroupBox):


class DataForm(QtGui.QGroupBox):
   signal_hided = QtCore.pyqtSignal()
   signal_shown = QtCore.pyqtSignal()
   def __init__(self, parent):
       QtGui.QGroupBox.__init__(self, parent)

def showEvent(self, event):
   super(DataForm, self).showEvent(event)
   self.signal_shown.emit()

   children = self.children()
   for widget in children:
       print('DataForm:showEvent=', widget.objectName()) 
Reply


Messages In This Thread
Get class 's children on init - by panoss - Jan-05-2017, 07:17 PM
RE: Get class 's children on init - by nilamo - Jan-05-2017, 08:42 PM
RE: Get class 's children on init - by panoss - Jan-05-2017, 09:48 PM
RE: Get class 's children on init - by panoss - Jan-06-2017, 08:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to iterate through sub-children in TkTree? WuchaDoin 0 6,957 Dec-21-2018, 07:00 PM
Last Post: WuchaDoin

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020