Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web Graphics] Two failures with one simple PyROOT plotter #15474

Open
1 task done
dpiparo opened this issue May 10, 2024 · 4 comments
Open
1 task done

[Web Graphics] Two failures with one simple PyROOT plotter #15474

dpiparo opened this issue May 10, 2024 · 4 comments
Assignees

Comments

@dpiparo
Copy link
Member

dpiparo commented May 10, 2024

Check duplicate issues.

  • Checked for duplicates

Description

On macOS, it is possible to demonstrate two bugs of the WebGraphics with one simple PyROOT script:

  1. A crash, upon first execution
  2. A system freeze, once the browser is loaded

Crash

Upon first execution, a browser window is loaded, however the script exits, even if the input function should stop execution. The error message:

[70538:42503:0510/092746.969274:ERROR:trust_store_mac.cc(750)] Error parsing certificate:
ERROR: Failed parsing extensions
[70538:259:0510/092747.479455:ERROR:background_contents_service.cc(441)] No extension found for BackgroundContents - id = ejidjjhkpiekdjhfgtyshbnagldlkglhimk

$ 
-> Created TensorFlow Lite XNNPACK delegate for CPU.

The last line is not a mistake: it really appears on my terminal.

Faulty behaviour: Freeze

Now that chrome is loaded, if I re-launch the same script, everything stop before quitting as expected, the webcanvas window is displayed, however it's not responsive: whatever is clicked has no effect.

Reproducer

import ROOT

ROOT.gROOT.SetWebDisplay()

c = ROOT.TCanvas()
h = ROOT.TH1D("","",64, -4,4)
h.FillRandom("gaus")
h.Draw()

input("Press Enter to exit")

ROOT version

6.32 and master

Installation method

Sources

Operating system

MacOS 14

Additional context

No response

@linev
Copy link
Member

linev commented May 13, 2024

How you start python - with or without -i flag?

Graphics (normal or web) can normally works only in interactive python mode.
In such case canvas will be updated while input() is waiting for key.

In none-interactive mode events processing does not work.

@linev
Copy link
Member

linev commented May 13, 2024

I create separate issue #15498 concerning gPad in this script.
For me python creates second canvas - without real need.

@dpiparo
Copy link
Member Author

dpiparo commented May 20, 2024

Thanks. I do not understand. I proposed a simple reproducer that illustrates a bad user experience, very bad, that makes the system unusable. What is the strategy to fix this bug?

@linev
Copy link
Member

linev commented May 21, 2024

Again, workaround with calling input() function in python does not work - neither with web not with normal ROOT graphics. Only when enabling interactive python mode python - i one gets ROOT events processing working.

This problem well known and I discussed it some time ago with @vepadulano.
To make it working one need to provide special TCanvas method which only can be used in python and which properly handle ROOT events processing. Like show method in mathplotlib. Naively TCanvas::Show() can look like:

def TCanvas_Show(self) :
   # really display canvas
   self._OriginalDraw() 
   // process event until key pressed or Ctrl-C pressed
   while (not_key_press() and not_ctrl_c_pressed()):
      gROOT.ProcessEvents()

Most probably it can be introduced in _pythonization/_drawables.py.
But I am not an python/PyROOT expert and have no idea how it can be properly programmed - including keyboard/signals handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants