RE: RE: PyQt and PyROOT

From: <WLavrijsen_at_lbl.gov>
Date: Fri, 12 Jan 2007 16:43:54 -0800 (PST)


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 Sat Jan 13 2007 - 01:44:07 CET

This archive was generated by hypermail 2.2.0 : Mon Jan 15 2007 - 23:50:00 CET