Posted By

gdonald on 09/27/06


Tagged

window ncurses


Versions (?)

PHP ncurses window


 / Published in: PHP
 

  1. #!/usr/bin/env php
  2. <?php
  3.  
  4. // we begin by initializing ncurses
  5. $ncurse = ncurses_init();
  6.  
  7. // let ncurses know we wish to use the whole screen
  8. $fullscreen = ncurses_newwin(0, 0, 0, 0);
  9.  
  10. // draw a border around the whole thing.
  11. ncurses_border(0,0, 0,0, 0,0, 0,0);
  12.  
  13. // now lets create a small window
  14. $small = ncurses_newwin(10, 30, 7, 25);
  15.  
  16. // border our small window.
  17. ncurses_wborder($small,0,0, 0,0, 0,0, 0,0);
  18.  
  19. ncurses_refresh();// paint both windows
  20.  
  21. // move into the small window and write a string
  22. ncurses_mvwaddstr($small, 5, 5, " Test String ");
  23.  
  24. // show our handiwork and refresh our small window
  25. ncurses_wrefresh($small);
  26.  
  27. $pressed = ncurses_getch();// wait for a user keypress
  28.  
  29. ncurses_end();// clean up our screen
  30.  
  31. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: chcn001 on April 12, 2010

采用php开发终端字符界面 http://www.phpcoding.cn/2009/06/01/dev-terminal-by-php/

这里有一个关于ncurses的具体实例。。。

You need to login to post a comment.