Pyroot TCanvas unresponsive [6.24/06 precompiled, Win11, VStudio 2019 or 2022, python 3.8.10 (32-bit)]
- [X] Checked for duplicates
Describe the bug
After creating a new TCanvas with Pyroot, moving the cursor over the TCanvas window displays the Windows wait-cursor, and clicking the window makes it hang and show "Not Responding" in the title bar.
Expected behavior
The newly created TCanvas should be responsive, as it is when created from the ROOT command prompt instead of in Pyroot.
To Reproduce (in VStudio x86 native tools command window)
c:\root_v6.24.06\bin\thisroot.bat python
import ROOT c1 = ROOT.TCanvas("blah", "blah blah", 800, 600)
(canvas opens but is unresponsive)
Setup
ROOT 6.24.06 precompiled binaries (built Sep 02 2021, 14:20:23) Windows 11 Pro Python 3.8.10 (32-bit) VStudio 2019 (16.11.9) or 2022 (17.0.5) Community edition
Additional context
ROOT appears to behave properly when launched from the command prompt.
It looks like a Windows issue. May be @bellenot has some ideas about it. Also it might be something connected to Python and in that case @etejedor can also help.
Yes, this is a known issue, and there is no solution for the time being,
One possible workaround is to use ROOT7 WebGUI by changing the following line in system.rootrc (or your own .rootrc):
Gui.Factory: native
To:
Gui.Factory: web
Then it works:
C:\Users\bellenot\build\x86\release\tutorials>python
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:04:37) [MSC v.1929 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> f = ROOT.TFile.Open("hsimple.root")
>>> hpx=f.Get("hpx")
>>> hpx.Draw()
Info in <THttpEngine::Create>: Starting HTTP server on port 8979
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
>>> quit()
But there are still issues to be fixed on Windows...
Sorry for the naive question, but does your example work with 6.24.06?
I have changed .rootrc, and the environment shows
Gui.Factory: web [Local]
as expected, but when I run your commands, no http server creation message is displayed.
@dwcasper sorry, you're right, it doesn't work with v6.24.06. If you want to try, you can either take a nightly build, or wait for the upcoming v6.26.00.
I think this has been fixed in 28,30 and master: am I right?
I am closing the issue. Feel free to re-open it in case this is still an issue.
It still doesn't work on Windows
So the WebGUI (in master) works, or adding the following lines make it work as well:
try:
while not gSystem.ProcessEvents():
time.sleep(0.02)
except KeyboardInterrupt:
print('interrupted!')
For example:
>>> import time
>>> import ROOT
>>> f = ROOT.TFile.Open("hsimple.root")
>>> hpx=f.Get("hpx")
>>> hpx.Draw()
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
>>> try:
... while not ROOT.gSystem.ProcessEvents():
... time.sleep(0.02)
... except KeyboardInterrupt:
... print('interrupted!')