[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] PyQt connect Qwidget on click
From: Pierre Barthelemy <barthpi () gmail ! com>
Date: 2012-04-12 18:35:53
Message-ID: CAB2iWq2pz-yy4=S_+2KqvntwGs+49cpuDKYDiEZXiW347TOPPA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello,
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
PyQt4.QtGui.QWidget.
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):
self.activeplot=None
self.plot_dict={}
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,
Pierre
[Attachment #5 (text/html)]
<span style>Hello, </span><div style><br></div><div style>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 PyQt4.QtGui.QWidget. </div> <div style>As i want \
to have different processes, i embed all the Qwidget generated in a dictionnary, \
itself part of a "plot_manager" object:</div><div style><br></div><div \
style><div>class PlotManager():</div><div> def __init__(self,plotwindow):</div><div> \
self.activeplot=None</div><div> \
self.plot_dict={}</div><div><br></div></div><div style>Each time i generate a plot, i \
update the PlotManager.plot_dict: </div><div style> plot_dict={'Fig0':QWidget \
Instance, Fig1':Qwidget Instance, ... }</div><div style><br></div><div style>The \
activeplot attribute of the PlotManager serves to determine which of the generated \
plots has the focus, and can be modified by the program. </div> <div style>What i \
would like to do is to change the activeplot when i click on one of the QWidget \
window. </div><div style><br></div><div style>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). </div> <div style>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 ? </div><div style><br></div><div style>Thanks a lot,</div> \
<div style><br></div><div style>Pierre</div>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic