Hi, I want to add a QT4 widget to a matplotlib figure, but the widget does not react to user input.
Here it is a test case: from PyQt4 import QtGui, QtCore from pylab import * def test(): plot([1,2,3], lw=2) qt4_interface(gcf()) class qt4_interface: def __init__(self,fig): QMainWin = fig.canvas.parent() toolbar = QtGui.QToolBar(QMainWin) QMainWin.addToolBar(QtCore.Qt.BottomToolBarArea, toolbar) self.line_edit = QtGui.QLineEdit(parent=toolbar) self.line_edit.editingFinished.connect(self.do_something) toolbar.addWidget(self.line_edit) def do_something(self, *args): f = open('l','a'); f.write('yes\n'); f.flush(); f.close() #close() I run the script as "run -i qt4_test.py" from ipython. Then running test() I get the figure with the additional widget but the do_something method is never called. Incidentally if I do a plot from ipython and then I type interactively qt4_interface(gcf()), the qt4 widget is added to the figure and works properly. Any hints on how can I resolve this problem? BTW, I'm running matplotlib official package (1.0.1) included in ubuntu 11.10. Thanks, Antonio
qt4_test.py
Description: Binary data
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users