I have a problem trying to hide/show my widget.
This is an example of what I have:

main.py
Qt Code:
  1. class Main(QMainWindow):
  2. def __init__(self):
  3. QMainWindow.__init__(self, parent=None)
  4. self.gui = Gui()
  5.  
  6. def onMyCustomEvent(self):
  7. self.gui.showOrHide() #<---- SEGFAULT
  8.  
  9. app = QtGui.QApplication(sys.argv)
  10. window = Main()
  11. sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode 

gui.py
Qt Code:
  1. class Gui(QWidget):
  2. def __init__(self):
  3. QWidget.__init__(self, parent=None)
  4. #set size of widget
  5. #set title
  6. #.....
  7. #.....
  8.  
  9. def showOrHide(self):
  10. if self.isVisible():
  11. self.setVisible(False)
  12. else:
  13. self.setVisible(True)
To copy to clipboard, switch view to plain text mode 

So, this is the code, and when I try to show or hide the gui, I get a SEGFAULT or a message saying "QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread". The SEGFAULT and the message appear randomly.
I have searched and the message means that I must use processEvent, postEvent and so on because I'm trying to access a gui from another thread, but I'm _not_! I don't use threads in my app, so I'm a little confused.
Why could be happening?

Thanks