RE: RE: PyQt and PyROOT

From: Fine, Valeri <fine_at_bnl.gov>
Date: Tue, 16 Jan 2007 00:32:42 -0500


Hello Johan,  

I could not understand your Qt layout idea. Does it work without ROOT ?
For example, can you replace the TQtWidget with some QLabel and re-run your script with NO (!!!) PyROOT at all?  

On the other hand I would like to comment that you should remove from your script the lines:  

> application.exec_loop()
 

QtRoot does this and the second event loop may cause the problem  

> self.Canvas.resize(300, 300)

because the size is to be set by layout

> self.Canvas.Refresh()

No need to refresh, because TCanvas is embedded and it is to be refreshed by the parent widget.
> self.resize(350, 350)

is called too earlier. You should define the final widget size after you create its layout. i.e. from your main

Anyway the main question is still persisting. What do you want your widget looks like?

To separate things, can you show this by replacing TQtWidget with the regular QWidget (for example QLabel), with neither PyROOT nor QtRoot? I.e. with PyQt alone?

(Attention, To run PyQt with no QtRoot you do need application.exec_loop())

Thank you.

My best regards, Valeri


From: Johan Bregeon [mailto:johan.bregeon_at_pi.infn.it] Sent: Mon 1/15/2007 12:41 PM
To: WLavrijsen_at_lbl.gov
Cc: Fine, Valeri; Luca Baldini; ROOT Talk Subject: Re: [ROOT] RE: PyQt and PyROOT

Thanks all for your help,
we were able to solve a couple of more problems following your advice, but unfortunately we couldn't have something stable working. but we actually do not have the time / man power /knowledge to go further with building up a ROOT application with a Qt gui, using pyroot and pyqt, so we decided to stop here on that point.

Our new idea is to use only pyRoot for this purpose, so let me start another trade...
cheers,
Johan

WLavrijsen_at_lbl.gov wrote:
> Dear all,
>
>
>> 2) What is creating the 'other' QApplication ? (we instance only one in
>> the main !)
>>
>
> well, some gApplication will need to exist at some point: both ROOT GUI (e.g.
> your histo display) as well as Qt (buttons, frame, etc.) will need to receive
> notifications from the OS, which are dispatched in a mainloop. If not, parts
> of your GUI will freeze. You can either dispatch to both systems yourself, by
> writing your own mainloop, or let QtRoot take care of it, following Valeri's
> instructions.
>
>
>> ROOT had been started (QApplication was created too via ROOT Qt
>> plug-in). May be, Wim can explain us at which point the PyROOT
>> instantiates ROOT.
>>
>
> For ROOT 5.14, you can actually override gApplication, as long as you do it
> between "import ROOT" and the first use of ROOT.<anything other than gROOT>.
> Of course, some calls on gROOT trigger the creation of a default gApplication.
>
> In your script, application creation is done later, and a TPyROOTApplication
> is created by that time (PyROOT does a simple check if ( ! gApplication ) on
> the first access to anything other than gROOT in the ROOT module, to see if it
> should create an application). I.e., this line: "ROOT.gSystem.Load('qtcint')".
>
> Note that TPyROOTApplication is nothing but a trivial TApplication derived,
> where the real work is done.
>
> HTH,
> Wim
> --
> Wim.Lavrijsen_at_cern.ch -- WLavrijsen_at_lbl.gov -- www.lavrijsen.net
>
> "Stop making excuses for your software." --first step towards quality
> "GIGO is not a valid design pattern." --corollary
>
Received on Tue Jan 16 2007 - 06:33:02 CET

This archive was generated by hypermail 2.2.0 : Tue Jan 16 2007 - 11:50:00 CET