From: <sg...@ol...> - 2006-08-15 20:05:49
|
Thank you very much. What I would like is example for embedding_in_qt.py but whith qt4 when I tried : import PyQt4 from PyQt4.QtCore import * from PyQt4.QtGui import * from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure but I have : Traceback (most recent call last): File "embedding_in_qt.py", line 26, in ? from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_qtagg.py", line 12, in ? from backend_qt import qt, FigureManagerQT, FigureCanvasQT,\ File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_qt.py", line 18, in ? import qt RuntimeError: the qt and PyQt4.QtCore modules both wrap the QObject class I have a debian sid machine and the package python-matplotlib depends on python-qt3. But the package python-qt4 exists. Any ideas what to do ? Samuel |
From: Darren D. <dd...@co...> - 2006-08-15 20:50:16
|
On Tuesday 15 August 2006 16:05, sg...@ol... wrote: > Thank you very much. > > What I would like is example for embedding_in_qt.py but whith qt4 > > when I tried : > > import PyQt4 > from PyQt4.QtCore import * > from PyQt4.QtGui import * > > from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as > FigureCanvas > from matplotlib.figure import Figure > > but I have : > > Traceback (most recent call last): You should be doing this instead: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas Darren |
From: Samuel G. <sg...@ol...> - 2006-08-16 08:54:23
|
Thank you, Sorry I did known the existence of matplotlib.backends.backend_qt4agg. It is more easy than I thought. but I still have a problem. This is my code : import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure #------------------------------------------------------------------------------ class MyWidget(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent) self.menuBar = QMenuBar() self.fileMenu = QMenu(self.tr("&File"), self) self.menuBar.addMenu(self.fileMenu) mainLayout = QVBoxLayout() mainLayout.setMenuBar(self.menuBar) self.setLayout(mainLayout) #------------------------------------------------------------------------------ if __name__ == "__main__": app = QApplication(sys.argv) dialog = MyWidget() dialog.show() sys.exit(app.exec_()) and it does not works because the main window is blocking. But when I comment this line : #from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas it works ! What am I doing wrong ? PyQT4 is 4.0.1 Matplotlib is 0.87.4 Samuel Darren Dale wrote: > On Tuesday 15 August 2006 16:05, sg...@ol... wrote: > >> Thank you very much. >> >> What I would like is example for embedding_in_qt.py but whith qt4 >> >> when I tried : >> >> import PyQt4 >> from PyQt4.QtCore import * >> from PyQt4.QtGui import * >> >> from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as >> FigureCanvas >> from matplotlib.figure import Figure >> >> but I have : >> >> Traceback (most recent call last): >> > > You should be doing this instead: > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas > > Darren > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Darren D. <dd...@co...> - 2006-08-16 12:14:12
|
On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: > I still have a problem. This is my code : > > import sys > > from PyQt4.QtCore import * > from PyQt4.QtGui import * > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as > FigureCanvas > from matplotlib.figure import Figure > > #-------------------------------------------------------------------------- >---- class MyWidget(QWidget): > def __init__(self, parent=None): > QWidget.__init__(self, parent) > self.menuBar = QMenuBar() > self.fileMenu = QMenu(self.tr("&File"), self) > self.menuBar.addMenu(self.fileMenu) > > mainLayout = QVBoxLayout() > mainLayout.setMenuBar(self.menuBar) > > self.setLayout(mainLayout) > > #-------------------------------------------------------------------------- >---- if __name__ == "__main__": > app = QApplication(sys.argv) > dialog = MyWidget() > dialog.show() > sys.exit(app.exec_()) > > and it does not works because the main window is blocking. > But when I comment this line : > #from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as > FigureCanvas > it works ! > What am I doing wrong ? You may not be doing anything wrong. The qt4 backend is new and hasn't seen much use. I think you are the first to try to embed in your own qt4 application. If you feel up to it, maybe you could try to track down the problem. Darren |
From: Samuel G. <sg...@ol...> - 2006-08-16 12:50:09
|
I am not good enougth track and solve the problem. Maybe I can be a beta tester. I saw in svn that the author of qt4 backend is Charlie Moad. And it is very young (6 weeks). So a question for Charlie moad : do you have a example which could work on my debian unstable station for embedding_in_qt4.py ? thank you Samuel Darren Dale wrote: > On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: > >> I still have a problem. This is my code : >> >> import sys >> >> from PyQt4.QtCore import * >> from PyQt4.QtGui import * >> >> from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as >> FigureCanvas >> from matplotlib.figure import Figure >> >> #-------------------------------------------------------------------------- >> ---- class MyWidget(QWidget): >> def __init__(self, parent=None): >> QWidget.__init__(self, parent) >> self.menuBar = QMenuBar() >> self.fileMenu = QMenu(self.tr("&File"), self) >> self.menuBar.addMenu(self.fileMenu) >> >> mainLayout = QVBoxLayout() >> mainLayout.setMenuBar(self.menuBar) >> >> self.setLayout(mainLayout) >> >> #-------------------------------------------------------------------------- >> ---- if __name__ == "__main__": >> app = QApplication(sys.argv) >> dialog = MyWidget() >> dialog.show() >> sys.exit(app.exec_()) >> >> and it does not works because the main window is blocking. >> But when I comment this line : >> #from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as >> FigureCanvas >> it works ! >> What am I doing wrong ? >> > > You may not be doing anything wrong. The qt4 backend is new and hasn't seen > much use. I think you are the first to try to embed in your own qt4 > application. If you feel up to it, maybe you could try to track down the > problem. > > Darren > |
From: Charlie M. <cw...@gm...> - 2006-08-16 13:04:01
|
I am not the author of it. I just may of made the last commits to it. I am pretty sure Darren wrote the initial implimentatin. The only example that exists right now is animation_blit_qt4.py. On 8/16/06, Samuel GARCIA <sg...@ol...> wrote: > > I am not good enougth track and solve the problem. > Maybe I can be a beta tester. > > I saw in svn that the author of qt4 backend is Charlie Moad. > And it is very young (6 weeks). > > So a question for Charlie moad : do you have a example which could work on > my debian unstable station for embedding_in_qt4.py ? > > thank you > > Samuel > > > > Darren Dale wrote: > On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: > > > I still have a problem. This is my code : > > import sys > > from PyQt4.QtCore import * > from PyQt4.QtGui import * > > from matplotlib.backends.backend_qt4agg import > FigureCanvasQTAgg as > FigureCanvas > from matplotlib.figure import Figure > > #-------------------------------------------------------------------------- > ---- class MyWidget(QWidget): > def __init__(self, parent=None): > QWidget.__init__(self, parent) > self.menuBar = QMenuBar() > self.fileMenu = QMenu(self.tr("&File"), self) > self.menuBar.addMenu(self.fileMenu) > > mainLayout = QVBoxLayout() > mainLayout.setMenuBar(self.menuBar) > > self.setLayout(mainLayout) > > #-------------------------------------------------------------------------- > ---- if __name__ == "__main__": > app = QApplication(sys.argv) > dialog = MyWidget() > dialog.show() > sys.exit(app.exec_()) > > and it does not works because the main window is blocking. > But when I comment this line : > #from matplotlib.backends.backend_qt4agg import > FigureCanvasQTAgg as > FigureCanvas > it works ! > What am I doing wrong ? > > You may not be doing anything wrong. The qt4 backend is new and hasn't seen > much use. I think you are the first to try to embed in your own qt4 > application. If you feel up to it, maybe you could try to track down the > problem. > > Darren > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > |
From: Darren D. <dd...@co...> - 2006-08-16 13:00:01
|
On Wednesday 16 August 2006 08:49, Samuel GARCIA wrote: > I am not good enougth track and solve the problem. > Maybe I can be a beta tester. > > I saw in svn that the author of qt4 backend is Charlie Moad. > And it is very young (6 weeks). I think you misread the svn entry. James Amundson ported the qt3 backend to qt4, but it was not quite finished. I finished the port and committed it. Charlie added blitting. |
From: Samuel G. <sg...@ol...> - 2006-08-16 13:33:37
|
Sorry for the mistake. Darren Dale wrote: > On Wednesday 16 August 2006 08:49, Samuel GARCIA wrote: > >> I am not good enougth track and solve the problem. >> Maybe I can be a beta tester. >> >> I saw in svn that the author of qt4 backend is Charlie Moad. >> And it is very young (6 weeks). >> > > I think you misread the svn entry. James Amundson ported the qt3 backend to > qt4, but it was not quite finished. I finished the port and committed it. > Charlie added blitting. > |
From: Darren D. <dd...@co...> - 2006-08-18 12:27:25
|
On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: > Thank you, > Sorry I did known the existence of matplotlib.backends.backend_qt4agg. > It is more easy than I thought. > > but I still have a problem. This is my code : > > import sys > > from PyQt4.QtCore import * > from PyQt4.QtGui import * > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as > FigureCanvas > from matplotlib.figure import Figure > > #-------------------------------------------------------------------------- >---- class MyWidget(QWidget): > def __init__(self, parent=None): > QWidget.__init__(self, parent) > self.menuBar = QMenuBar() > self.fileMenu = QMenu(self.tr("&File"), self) > self.menuBar.addMenu(self.fileMenu) > > mainLayout = QVBoxLayout() > mainLayout.setMenuBar(self.menuBar) > > self.setLayout(mainLayout) > > #-------------------------------------------------------------------------- >---- if __name__ == "__main__": > app = QApplication(sys.argv) > dialog = MyWidget() > dialog.show() > sys.exit(app.exec_()) > > and it does not works because the main window is blocking. I'll try to have a look this weekend. Darren |
From: Darren D. <dd...@co...> - 2006-08-19 16:05:07
|
On Friday 18 August 2006 08:27, Darren Dale wrote: > On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: > > Thank you, > > Sorry I did known the existence of matplotlib.backends.backend_qt4agg. > > It is more easy than I thought. > > > > but I still have a problem. This is my code : > > > > import sys > > > > from PyQt4.QtCore import * > > from PyQt4.QtGui import * > > > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as > > FigureCanvas > > from matplotlib.figure import Figure > > > > #------------------------------------------------------------------------ > >-- ---- class MyWidget(QWidget): > > def __init__(self, parent=None): > > QWidget.__init__(self, parent) > > self.menuBar = QMenuBar() > > self.fileMenu = QMenu(self.tr("&File"), self) > > self.menuBar.addMenu(self.fileMenu) > > > > mainLayout = QVBoxLayout() > > mainLayout.setMenuBar(self.menuBar) > > > > self.setLayout(mainLayout) > > > > #------------------------------------------------------------------------ > >-- ---- if __name__ == "__main__": > > app = QApplication(sys.argv) > > dialog = MyWidget() > > dialog.show() > > sys.exit(app.exec_()) > > > > and it does not works because the main window is blocking. There is a comment in the embedding_in_qt.py example: # The QApplication has to be created before backend_qt is imported, otherwise # it will create one itself. This goes for qt4 as well, and is the source of the problem. You can have only one QApplication at a time. (Ted, John, do you think the QApplication really needs to be created during the module import? show() is the only function that looks for the QApplication, maybe the qApp should be created there instead. Any reason against?) I added an example, embedding_in_qt4.py, to the svn repository. It is closely based on embedding_in_qt.py. Darren |
From: Charlie M. <cw...@gm...> - 2006-08-19 16:47:09
|
On 8/19/06, Darren Dale <dd...@co...> wrote: > On Friday 18 August 2006 08:27, Darren Dale wrote: > > On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: > > > Thank you, > > > Sorry I did known the existence of matplotlib.backends.backend_qt4agg. > > > It is more easy than I thought. > > > > > > but I still have a problem. This is my code : > > > > > > import sys > > > > > > from PyQt4.QtCore import * > > > from PyQt4.QtGui import * > > > > > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as > > > FigureCanvas > > > from matplotlib.figure import Figure > > > > > > #------------------------------------------------------------------------ > > >-- ---- class MyWidget(QWidget): > > > def __init__(self, parent=None): > > > QWidget.__init__(self, parent) > > > self.menuBar = QMenuBar() > > > self.fileMenu = QMenu(self.tr("&File"), self) > > > self.menuBar.addMenu(self.fileMenu) > > > > > > mainLayout = QVBoxLayout() > > > mainLayout.setMenuBar(self.menuBar) > > > > > > self.setLayout(mainLayout) > > > > > > #------------------------------------------------------------------------ > > >-- ---- if __name__ == "__main__": > > > app = QApplication(sys.argv) > > > dialog = MyWidget() > > > dialog.show() > > > sys.exit(app.exec_()) > > > > > > and it does not works because the main window is blocking. > > There is a comment in the embedding_in_qt.py example: > > # The QApplication has to be created before backend_qt is imported, otherwise > # it will create one itself. > > This goes for qt4 as well, and is the source of the problem. You can have only > one QApplication at a time. (Ted, John, do you think the QApplication really > needs to be created during the module import? show() is the only function > that looks for the QApplication, maybe the qApp should be created there > instead. Any reason against?) > > I added an example, embedding_in_qt4.py, to the svn repository. It is closely > based on embedding_in_qt.py. >From what I saw, creating QApp in show makes more sense. - Charlie |
From: Darren D. <dd...@co...> - 2006-08-27 17:44:09
|
On Saturday 19 August 2006 12:47, Charlie Moad wrote: > On 8/19/06, Darren Dale <dd...@co...> wrote: > > On Friday 18 August 2006 08:27, Darren Dale wrote: > > > On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: > > > > Thank you, > > > > Sorry I did known the existence of > > > > matplotlib.backends.backend_qt4agg. It is more easy than I thought. > > > > > > > > but I still have a problem. This is my code : > > > > > > > > import sys > > > > > > > > from PyQt4.QtCore import * > > > > from PyQt4.QtGui import * > > > > > > > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as > > > > FigureCanvas > > > > from matplotlib.figure import Figure > > > > > > > > #-------------------------------------------------------------------- > > > >---- -- ---- class MyWidget(QWidget): > > > > def __init__(self, parent=None): > > > > QWidget.__init__(self, parent) > > > > self.menuBar = QMenuBar() > > > > self.fileMenu = QMenu(self.tr("&File"), self) > > > > self.menuBar.addMenu(self.fileMenu) > > > > > > > > mainLayout = QVBoxLayout() > > > > mainLayout.setMenuBar(self.menuBar) > > > > > > > > self.setLayout(mainLayout) > > > > > > > > #-------------------------------------------------------------------- > > > >---- -- ---- if __name__ == "__main__": > > > > app = QApplication(sys.argv) > > > > dialog = MyWidget() > > > > dialog.show() > > > > sys.exit(app.exec_()) > > > > > > > > and it does not works because the main window is blocking. > > > > There is a comment in the embedding_in_qt.py example: > > > > # The QApplication has to be created before backend_qt is imported, > > otherwise # it will create one itself. > > > > This goes for qt4 as well, and is the source of the problem. You can have > > only one QApplication at a time. (Ted, John, do you think the > > QApplication really needs to be created during the module import? show() > > is the only function that looks for the QApplication, maybe the qApp > > should be created there instead. Any reason against?) > > > > I added an example, embedding_in_qt4.py, to the svn repository. It is > > closely based on embedding_in_qt.py. > > From what I saw, creating QApp in show makes more sense. I changed the qt backends to create a QApplication in show() rather than at the time of module import. I also updated the embedding_in_qt* examples. Samuel, as of svn 2711, you are free to create your QApplication *after* you import backend_qt(4). Darren P.S.- For anyone who is interested, I'd recommend "C++ GUI Programming with Qt 4" (available at Amazon). I'm not an experienced C++ programmer, but the book has an excellent (and brief) introduction to C++ in the appendix, and is easy enough to understand for anyone who wants to work with PyQt4. |
From: Samuel G. <sg...@ol...> - 2006-08-28 07:21:42
|
Darren Dale wrote: > On Saturday 19 August 2006 12:47, Charlie Moad wrote: > >> On 8/19/06, Darren Dale <dd...@co...> wrote: >> >>> On Friday 18 August 2006 08:27, Darren Dale wrote: >>> >>>> On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: >>>> >>>>> Thank you, >>>>> Sorry I did known the existence of >>>>> matplotlib.backends.backend_qt4agg. It is more easy than I thought. >>>>> >>>>> but I still have a problem. This is my code : >>>>> >>>>> import sys >>>>> >>>>> from PyQt4.QtCore import * >>>>> from PyQt4.QtGui import * >>>>> >>>>> from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as >>>>> FigureCanvas >>>>> from matplotlib.figure import Figure >>>>> >>>>> #-------------------------------------------------------------------- >>>>> ---- -- ---- class MyWidget(QWidget): >>>>> def __init__(self, parent=None): >>>>> QWidget.__init__(self, parent) >>>>> self.menuBar = QMenuBar() >>>>> self.fileMenu = QMenu(self.tr("&File"), self) >>>>> self.menuBar.addMenu(self.fileMenu) >>>>> >>>>> mainLayout = QVBoxLayout() >>>>> mainLayout.setMenuBar(self.menuBar) >>>>> >>>>> self.setLayout(mainLayout) >>>>> >>>>> #-------------------------------------------------------------------- >>>>> ---- -- ---- if __name__ == "__main__": >>>>> app = QApplication(sys.argv) >>>>> dialog = MyWidget() >>>>> dialog.show() >>>>> sys.exit(app.exec_()) >>>>> >>>>> and it does not works because the main window is blocking. >>>>> >>> There is a comment in the embedding_in_qt.py example: >>> >>> # The QApplication has to be created before backend_qt is imported, >>> otherwise # it will create one itself. >>> >>> This goes for qt4 as well, and is the source of the problem. You can have >>> only one QApplication at a time. (Ted, John, do you think the >>> QApplication really needs to be created during the module import? show() >>> is the only function that looks for the QApplication, maybe the qApp >>> should be created there instead. Any reason against?) >>> >>> I added an example, embedding_in_qt4.py, to the svn repository. It is >>> closely based on embedding_in_qt.py. >>> >> From what I saw, creating QApp in show makes more sense. >> > > I changed the qt backends to create a QApplication in show() rather than at > the time of module import. I also updated the embedding_in_qt* examples. > Samuel, as of svn 2711, you are free to create your QApplication *after* you > import backend_qt(4). > > Darren > > P.S.- For anyone who is interested, I'd recommend "C++ GUI Programming with Qt > 4" (available at Amazon). I'm not an experienced C++ programmer, but the book > has an excellent (and brief) introduction to C++ in the appendix, and is easy > enough to understand for anyone who wants to work with PyQt4.than you Thank you, for the moment It is not a problem for me te create the QApplication before. I have just 1 week to finish my project. And I use the debian package. So I don't have time to install svn version for the moment. I will try it in 2 or 3 weeks. Programming wyth PyQt4 and matplotlib is really great. You can create little but good loocking application in a very short time. Thany you for every people involved in these projects. Samuel |