Matt McCormick | 27 Aug 2009 19:09
Favicon
Gravatar

Veusz inside custom PyQt4 application, hello world

I am trying to build a PyQt4 application that uses veusz, but I am having
difficulties.  I am a relative newbie to PyQt4 and Veusz, but here is a Hello
World that shows what I am trying to do.

#!/usr/bin/env python

# A hello world example of using veusz in a PyQt4 app.

import numpy
import sys

from PyQt4 import QtCore, QtGui
app = QtGui.QApplication(sys.argv)

import veusz.windows.plotwindow
import veusz.document as document
from veusz.document.commandinterface import CommandInterface

class HelloMainWindow(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)

        self.statusBar().showMessage('Hello Veuz World!')

        menubar = self.menuBar()
        self.file_menu = menubar.addMenu('&File')

        self.exit_action = QtGui.QAction(QtGui.QIcon('icons/exit.png'), '&Quit',
self)
        self.exit_action.setShortcut('Ctrl+Q')
(Continue reading)

Matt McCormick | 27 Aug 2009 20:20
Favicon
Gravatar

Re: Veusz inside custom PyQt4 application, hello world

Matt McCormick <matt <at> ...> writes:

> 
> I am trying to build a PyQt4 application that uses veusz, but I am having
> difficulties.  I am a relative newbie to PyQt4 and Veusz, but here is a Hello
> World that shows what I am trying to do.
> 
> #!/usr/bin/env python
> 
> # A hello world example of using veusz in a PyQt4 app.
> 

OK, finally figured it out.

...
> app = QtGui.QApplication(sys.argv)
...

Turns out that doesn't work.  Veusz need some initialization functions.  The
following is needed instead.  Note stylesheet has to be imported before 
Application.

import veusz.setting.stylesheet
from veusz.application import Application
app = Application(sys.argv)
Bryan Harris | 27 Aug 2009 21:22

Re: Veusz inside custom PyQt4 application, hello world

Matt,


That sounds frustrating.


Jeremy,
Is there some reason we can't add:
> import veusz.setting.stylesheet
to the top of
> veusz.application
and avoid this sort of problem?


Bryan
--
Bryan Harris
Research Engineer
Structures and Materials Evaluation Group
brywilharris+gna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://www.udri.udayton.edu/
(937) 229-5561
On Thursday 27 August 2009 14:20:27 Matt McCormick wrote:
> Matt McCormick <matt <at> ...> writes:
> > I am trying to build a PyQt4 application that uses veusz, but I am having
> > difficulties. I am a relative newbie to PyQt4 and Veusz, but here is a
> > Hello World that shows what I am trying to do.
> >
> > #!/usr/bin/env python
> >
> > # A hello world example of using veusz in a PyQt4 app.
>
> OK, finally figured it out.
>
> ...
>
> > app = QtGui.QApplication(sys.argv)
>
> ...
>
> Turns out that doesn't work. Veusz need some initialization functions.
> The following is needed instead. Note stylesheet has to be imported before
> Application.
>
> import veusz.setting.stylesheet
> from veusz.application import Application
> app = Application(sys.argv)
>
>
>
>
> _______________________________________________
> Veusz-discuss mailing list
> Veusz-discuss-8nu/KwtRnEU@public.gmane.org
> https://mail.gna.org/listinfo/veusz-discuss


_______________________________________________
Veusz-discuss mailing list
Veusz-discuss@...
https://mail.gna.org/listinfo/veusz-discuss
Jeremy Sanders | 28 Aug 2009 10:59
Gravatar

Re: Veusz inside custom PyQt4 application, hello world

Bryan Harris wrote:

> Matt,
> 
> That sounds frustrating.
> 
> Jeremy,
> Is there some reason we can't add:
>> import veusz.setting.stylesheet
> to the top of
>> veusz.application
> and avoid this sort of problem?

I'll have a look at this...

Jeremy

Gmane