Skip to content

Commit 798d7da

Browse files
committed
[pyroot] handle ProcessEvents() return value
It is interrupt flag, which can be triggered from canvas context menu. Has similar effect as prssing space button
1 parent fc5e61b commit 798d7da

File tree

1 file changed

+6
-9
lines changed
  • bindings/pyroot/pythonizations/python/ROOT/_pythonization

1 file changed

+6
-9
lines changed

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tcanvas.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,21 @@
1111
from . import pythonization
1212

1313
def wait_press_windows():
14-
import ROOT
14+
from ROOT import gSystem
1515
import msvcrt
1616
import time
1717

18-
done = False
19-
while not done:
20-
k = ''
21-
ROOT.gSystem.ProcessEvents()
18+
while not gSystem.ProcessEvents():
2219
if msvcrt.kbhit():
2320
k = msvcrt.getch()
24-
done = k[0] == 32
21+
if k[0] == 32:
22+
break
2523
else:
2624
time.sleep(0.01)
2725

2826

2927
def wait_press_posix():
30-
import ROOT
28+
from ROOT import gSystem
3129
import sys
3230
import select
3331
import tty
@@ -40,8 +38,7 @@ def wait_press_posix():
4038

4139
try:
4240

43-
while True:
44-
ROOT.gSystem.ProcessEvents()
41+
while not gSystem.ProcessEvents():
4542
c = ''
4643
if select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []):
4744
c = sys.stdin.read(1)

0 commit comments

Comments
 (0)