[PyQt] still problem with mdi and signal stucked :(

Hans-Peter Jansen hpj at urpla.net
Sat Oct 10 19:56:44 BST 2009


Am Samstag 10 Oktober 2009 schrieb Giorgio Luciano:
> So I've tried to make things simplier but nothing seems to work
>
> I have a mdi area made using the editor and that is the code referred to
> it made by pyuic
>
>         self.centralwidget = QtGui.QWidget(MainWindow)
>         self.centralwidget.setObjectName("centralwidget")
>         self.mdiArea = QtGui.QMdiArea(self.centralwidget)
>         self.mdiArea.setMinimumSize(QtCore.QSize(200, 768))
>         self.mdiArea.setObjectName("mdiArea")
>
> in the mdi area I put my child called Mdi child calling in the main
>
>      def newTable(self):
>         child = self.createMdiChild()
>         child.newFile()
>         child.show()
>
>     def createMdiChild(self):
>         child = MdiChild(self)
>         self.ui.mdiArea.addSubWindow(child)
>         return child
>
> and that's work ... it creates my child in the main.. I also succeed in
> implementing the tiling of the windows and so on..
>
> now I want to call a method in the custom table which is inside the child
> using the toolbar in the mainwindow...
>  and so I defined a method inside my MdiChild
>
>  def paste(self):
>         print("paste")
>
> and I try to call it via the main after defining the active window
>
> def activeMdiChild(self):
>         return self.ui.mdiArea.activeSubWindow()
>
>     def paste(self):
>         self.ui.mdiArea.activeSubWindow.paste()

Try this:
         self.ui.mdiArea.activeSubWindow().paste()

By the way, that functionality is exactly, what signals and slots are made 
for. Try it.

> and that doesnt' work at all !!!
>
> I've tried all combinations I continue recevin the error
> AttributeError: ' builtin_function_or_method' object has no attribute
> paste

Pete


More information about the PyQt mailing list