[PyQt] PyQt connect Qwidget on click

Pierre Barthelemy barthpi at gmail.com
Thu Apr 12 19:35:53 BST 2012


I am using PyQt4 and chaco plot to make a data-analysis program.For each
analysis script i run, i generate a plot (chaco.plot) contained into a
As i want to have different processes, i embed all the Qwidget generated in
a dictionnary, itself part of a "plot_manager" object:

class PlotManager():
    def __init__(self,plotwindow):

Each time i generate a plot, i update the PlotManager.plot_dict:
plot_dict={'Fig0':QWidget Instance, Fig1':Qwidget Instance, ... }

The activeplot attribute of the PlotManager serves to determine which of
the generated plots has the focus, and can be modified by the program.
What i would like to do is to change the activeplot when i click on one of
the QWidget window.

I have tried to use the "mouseClickEvent" of the qwidget, but it does not
work: when i click on the plot, it seems that the focus is taken by the
children of the QWidget (the plot and toolbar inside).
Is there a signal that is emitted when one clicks on the widget, and could
i connect a function of the PlotManager that would then change the
activeplot ?

Thanks a lot,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120412/6986ecaf/attachment.html>

More information about the PyQt mailing list