Home>

I am making a GUI system with PySide2.
When a certain QDockWidget (Widget1) closes, I want to realize the operation of showing the QDockWidget (Widget2) that was hidden in advance, but I'm stumbling.
The processing flow currently being tried is as follows.

  1. Initially Widget2 is open, then hide itself after opening Widget1 in the middle
  2. Signal fire when Widget1 closes itself
  3. Widget2 shows itself

However, I get the following error.

'PySide2.QtCore.Signal' object has no attribute'connect'

Below is the source code.

class Widget1 (QDockWidget): Open after # Widget2 hides.
    closeSignal = Signal ()
    def __init __ (self, file_name):
        super (Widget1, self) .__ init __ ()
(Omitted: Button installation to execute close_Widget1)
    def close_Widget1 (self):
        self.closeSignal.emit ()
        self.close ()

class Widget2 (QDockWidget): # First opened.
    def __init __ (self, file_name):
        super (Widget2, self) .__ init__ ()
          (Omitted: Open widget1 and hide yourself.)
        Widget1.closeSignal.connect (self.widget1_show)
    @Slot ()
    def widget1_show (self):
        self.show ()

I can't figure out the cause even if I look it up.
Can anyone give me some advice?

In addition, we are not particular about processing using signals and slots, so
If the other process seems to be better, I'll try it.