mirror of
https://github.com/python/cpython.git
synced 2025-12-08 02:08:20 +00:00
Some small changes.
Raise ImportError instead of SystemExit when $DISPLAY is not set, so regrtest.py will do the right thing. Add a call to gl.clear() to clear the window before drawing in it. Add some verbose prints for completeness. Use gl.v2i() for the coordinates of one of the lines, for a little bit of variety. Reduce the time the window is displayed from 5 to 2 seconds.
This commit is contained in:
parent
a2a8b27221
commit
9d1a02ce33
1 changed files with 15 additions and 5 deletions
|
|
@ -87,7 +87,8 @@ def main():
|
||||||
try:
|
try:
|
||||||
display = os.environ['DISPLAY']
|
display = os.environ['DISPLAY']
|
||||||
except:
|
except:
|
||||||
raise SystemExit
|
# Raise ImportError because regrtest.py handles it specially.
|
||||||
|
raise ImportError, "No $DISPLAY -- skipping gl test"
|
||||||
|
|
||||||
# touch all the attributes of gl without doing anything
|
# touch all the attributes of gl without doing anything
|
||||||
if verbose:
|
if verbose:
|
||||||
|
|
@ -108,6 +109,9 @@ def main():
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'winopen "CrissCross"'
|
print 'winopen "CrissCross"'
|
||||||
w = gl.winopen('CrissCross')
|
w = gl.winopen('CrissCross')
|
||||||
|
if verbose:
|
||||||
|
print 'clear'
|
||||||
|
gl.clear()
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'ortho2'
|
print 'ortho2'
|
||||||
gl.ortho2(0.0, 400.0, 0.0, 400.0)
|
gl.ortho2(0.0, 400.0, 0.0, 400.0)
|
||||||
|
|
@ -130,12 +134,18 @@ def main():
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'bgnline'
|
print 'bgnline'
|
||||||
gl.bgnline()
|
gl.bgnline()
|
||||||
gl.v2f(400.0, 0.0)
|
|
||||||
gl.v2f(0.0, 400.0)
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'Displaying window for 5 seconds...'
|
print 'v2i'
|
||||||
|
gl.v2i(400, 0)
|
||||||
|
gl.v2i(0, 400)
|
||||||
|
if verbose:
|
||||||
|
print 'endline'
|
||||||
gl.endline()
|
gl.endline()
|
||||||
time.sleep(5)
|
if verbose:
|
||||||
|
print 'Displaying window for 2 seconds...'
|
||||||
|
time.sleep(2)
|
||||||
|
if verbose:
|
||||||
|
print 'winclose'
|
||||||
gl.winclose(w)
|
gl.winclose(w)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue