Dear all, I defined a few plot classes, children of qwidget, to handle chaco plots. I would like to have a way to connect a few functions to the event of clicking inside the window that i create. I have tried to implement a few events. In this class, the close event works well. But the other don't: when i click inside the qwidget, nothing happens. I would guess that it come from the fact that the chaco plot items take the focus, so that when i click inside the window, the chaco plot gets the event. Is there a way for me to have these events activated, even if the mouse click also activates events from the chaco plots ?
from PyQt4 import QtGui from enthought.enable.qt4.image import Window from enthought.chaco.toolbar_plot import ToolbarPlot class LinePlot(QtGui.QWidget): def __init__(self, parent, title, x, y, xtitle, ytitle, type="line", color="blue",comment=[],filepath=''): QtGui.QWidget.__init__(self) # Create the subclass's window self.enable_win = self._create_window(title, x, y, xtitle, ytitle, type, color,comment) layout = QtGui.QVBoxLayout() layout.setMargin(0) layout.addWidget(self.enable_win.control) self.setLayout(layout) self.resize(650,650) self.show() def _create_window(self, title): self._plotname = title self.plotdata = ArrayPlotData(x=x, y=y) plot = ToolbarPlot(self.plotdata, hiding=False, auto_hide=False) plot.plot(('x', 'y'), type=type, color=color) plot.title = title self.plot = plot return Window(self, -1, component=self.plot) def closeEvent(self,event): print 'CLOSE' def mouseReleaseEvent(self,event): print 'RELEASE' def mousePressEvent(self,event): print 'PRESS' def focusInEvent(self,event): print 'FOCUS'
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt