sdlterm/demo.py
changeset 69 4e7be77bafff
parent 48 1f00e90fd72a
equal deleted inserted replaced
68:bc51b0220be2 69:4e7be77bafff
     1 #!/usr/bin/env python3
     1 #!/usr/bin/env python3
     2 # -*- coding: utf-8 -*-
     2 # -*- coding: utf-8 -*-
     3 
       
     4 import sys
       
     5 sys.path.insert(0, 'build/lib.linux-x86_64-3.2')
       
     6 
     3 
     7 from sdlterm import SDLTerminal
     4 from sdlterm import SDLTerminal
     8 
     5 
     9 if __name__ == '__main__':
     6 if __name__ == '__main__':
    10     term = SDLTerminal()
     7     term = SDLTerminal()
    11     term.resize(800, 600)
     8     term.resize(800, 600)
    12     term.select_font("font/DejaVuSansMono.ttf", "font/DejaVuSansMono-Bold.ttf", 12)
     9     term.select_font(b"font/DejaVuSansMono.ttf", b"font/DejaVuSansMono-Bold.ttf", 12)
    13     term.erase()
    10     term.erase()
    14     term.putch(5, 5, 'W')
    11     term.putch(5, 5, 'W')
    15     term.commit()
    12     term.commit()
    16 
    13 
    17     while True:
    14     while True:
    18         event = term.get_next_event()
    15         event = term.wait_event()
    19         print(event)
    16         print(event)
    20         if event[0] == 'keypress' and event[1] == 'escape':
    17         if event[0] == 'keypress' and event[1] == 'escape':
    21             break
    18             break
    22 
    19