test.py 782 B

12345678910111213141516171819202122232425262728293031
  1. from tornado import gen
  2. from tornado.ioloop import IOLoop
  3. from tornado import websocket
  4. import json
  5. from wsrepl.ioloop import start_ioloop
  6. from wsrepl.interact import *
  7. from tornado.gen import sleep
  8. # 业务逻辑 协程
  9. def say_hello():
  10. # 向用户输出文字
  11. text_print("Welcome!!!")
  12. res = yield from input('This is single input')
  13. text_print('Your input:%s' % res)
  14. res = yield from input('This is another single input')
  15. text_print('Your input:%s' % res)
  16. res = yield from input_group('Group input', [
  17. input('Input 1', name='one'),
  18. input('Input 2', name='two'),
  19. select('Input 2', options=['A', 'B', 'C'], type=CHECKBOX, name='three')
  20. ])
  21. text_print('Your input:')
  22. json_print(res)
  23. start_ioloop(say_hello)