Hi <br><br>I want to add widget in (f1) function and want to remove the widget from (f2) function . I tried the same thing in same function it do work but when i try to remove the widget from another it doesnt . Any help ?<br>
<br>Code : <br><br><br>import sys,os<br>from functools import partial<br>from PyQt4 import QtGui, QtCore<br>import Skype4Py<br>import time<br>import socket<br><br><br>class main():<br> def f1(self):<br> print "f1"<br>
buttons['user'] = QtGui.QToolButton(widget)<br> layout.addWidget(buttons['user'])<br> widget.setLayout(layout)<br> def f2(self):<br> print "f2"<br>
layout.removeWidget(buttons['user'])<br> widget.setLayout(layout)<br><br><br>app = QtGui.QApplication(sys.argv)<br>widget = QtGui.QWidget()<br>layout = QtGui.QVBoxLayout()<br>buttons = {}<br>
sk = main()<br>sk.f1()<br>sk.f2()<br>widget.show()<br>sys.exit(app.exec_())<br>