Skip to content

Commit fb66cc8

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 0907674 commit fb66cc8

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
@@ -1,23 +1,21 @@
11
from . import pythonization
22

33
def wait_press_windows():
4-
import ROOT
4+
from ROOT import gSystem
55
import msvcrt
66
import time
77

8-
done = False
9-
while not done:
10-
k = ''
11-
ROOT.gSystem.ProcessEvents()
8+
while not gSystem.ProcessEvents():
129
if msvcrt.kbhit():
1310
k = msvcrt.getch()
14-
done = k[0] == 32
11+
if k[0] == 32:
12+
break
1513
else:
1614
time.sleep(0.01)
1715

1816

1917
def wait_press_posix():
20-
import ROOT
18+
from ROOT import gSystem
2119
import sys
2220
import select
2321
import tty
@@ -30,8 +28,7 @@ def wait_press_posix():
3028

3129
try:
3230

33-
while True:
34-
ROOT.gSystem.ProcessEvents()
31+
while not gSystem.ProcessEvents():
3532
c = ''
3633
if select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []):
3734
c = sys.stdin.read(1)

0 commit comments

Comments
 (0)