Movatterモバイル変換
[0]ホーム
curses.panel
Oleg Broytmannphd at phd.fep.ru
Tue Apr 24 10:41:35 EDT 2001
Hello! Is there anyone who program with curses these days? These days are fullof GUI and CGIs, but as they included curses.panel as a new module incurses, I think there are curses users. I want to learn curses. Yes, curses. If I would want to write a GUI - I'd do it with graphicaltoolkit, probably wxWindows. But now I want to learn curses. I am newbie in curses programming. I never wrote curses programs in C,and I want to learn curses by programming in Python. Ok, I wrote few very simple program - they work. So I started to writemore complex program... and stumbled upon panels. I cannot use panels -cannot change stack order, e.g. Can anyone help?from time import sleepimport curses, curses.paneldef make_panel(stdscr, h,l, y,x, str): win = stdscr.subwin(h,l, y,x) win.erase() win.box() win.addstr(2, 2, str) panel = curses.panel.new_panel(win) return win, paneldef test(stdscr): curses.curs_set(0) stdscr.box() stdscr.addstr(2, 2, "panels everywhere") win1, panel1 = make_panel(stdscr, 10,12, 5,5, "Panel 1") win2, panel2 = make_panel(stdscr, 10,12, 8,8, "Panel 2") stdscr.refresh() sleep(1) panel1.top(); curses.panel.update_panels() stdscr.refresh() sleep(1) # This DOES NOT work! panel1 is still bottom panel :((( for i in range(50): # This works... partially... panel1 is not updated :((( panel2.move(8, 8+i) stdscr.refresh() sleep(0.1) sleep(1)if __name__ == '__main__': curses.wrapper(test)Oleg.---- Oleg Broytmannhttp://phd.pp.ru/phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
More information about the Python-listmailing list
[8]ページ先頭