Skip to content

Commit

Permalink
[pyroot] handle ProcessEvents() return value
Browse files Browse the repository at this point in the history
It is interrupt flag, which can be triggered from canvas context menu.
Has similar effect as prssing space button
  • Loading branch information
linev committed Feb 6, 2025
1 parent 0907674 commit fb66cc8
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
from . import pythonization

def wait_press_windows():
import ROOT
from ROOT import gSystem
import msvcrt
import time

done = False
while not done:
k = ''
ROOT.gSystem.ProcessEvents()
while not gSystem.ProcessEvents():
if msvcrt.kbhit():
k = msvcrt.getch()
done = k[0] == 32
if k[0] == 32:
break
else:
time.sleep(0.01)


def wait_press_posix():
import ROOT
from ROOT import gSystem
import sys
import select
import tty
Expand All @@ -30,8 +28,7 @@ def wait_press_posix():

try:

while True:
ROOT.gSystem.ProcessEvents()
while not gSystem.ProcessEvents():
c = ''
if select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []):
c = sys.stdin.read(1)
Expand Down

0 comments on commit fb66cc8

Please sign in to comment.