Re: [ROOT] Drawing TCanvas w/o TApplication instance

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Mar 19 2003 - 12:07:37 MET


Hi Stanislas,

To get your program running, before creating the TCanvas, add the line
  TApplication myapp("myapp",0,0);

If you do not create a TApplication, Root will assume that you run in batch mode
and will not load the X11 libraries. This was an important requirement
for users running in batch mode and still producing graphics.

Note that a myapp.Run() statement is not required.

Rene Brun

Stanislav Nesterov wrote:
> 
>   Hello rooters,
> 
>   I'm wondering is it possible in new versions of ROOT > 3.03 to draw
> TCanvas without TApplication?
> 
>   I have small program
> 
> #include <TCanvas.h>
> #include <TH1.h>
> #include <iostream.h>
> int main()
> {
>   TCanvas *cc = new TCanvas("cc","Canvas",600,600);
>   TH1F *hh = new TH1("hh","Histo",50,-2,2);
>   hh->FillRandom("gaus",30000);
> 
>   hh->Draw();
> 
>   cc->Update();
>   char tmp;
>   cin>>tmp;  // wait for user response
> 
>   return 0;
> }
> 
>    on new versions of ROOT (3.04, 3.05)  this program draws nothing.
> 
>    Please give me hint how to make this program work.
> 
>                         Best regards,
>                                         Stanislaw.



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET