By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,750 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,750 IT Pros & Developers. It's quick & easy.

Problems with curses

P: n/a
I am making a text-based game similar to Zork with Python. I have
decided to use the curses module, and have run into a problem. I want
to scroll the commands and output up after a command is run instead of
clearing the screen. But when I use std.scroll(), an exception is
raised. Here is the program:

#!/usr/bin/env python

import curses
import curses.wrapper

def main(stdscr):
stdscr.setscrreg(1, 24)
score = 0
moves = 0
statusbar = stdscr.subwin(2, 80, 0, 0)
statusbar.addstr(0, 0, 'Dingo'+' '*(58-len('Dingo'))+'Score: %03d
Moves: %03d'%(score, moves), curses.A_REVERSE)
stdscr.addstr(24, 0, '')
x = stdscr.getstr(24, 2)
x = str(x)
# stdscr.erase()
statusbar.addstr(0, 0, x+' '*(58-len(x))+'Score: %03d Moves: %
03d'%(score, moves), curses.A_REVERSE)
stdscr.addstr(24, 0, '')
stdscr.getstr(24, 2)


Unfortunately, the error message isn't very helpful. I'm just hoping
somebody out there knows curses and has the answer.

-- Ratfink
Jul 13 '08 #1
Share this Question
Share on Google+
1 Reply

P: n/a
On Sat, 12 Jul 2008 20:49:56 -0400, Clay Hobbs wrote:
Unfortunately, the error message isn't very helpful.
But it would be helpful to tell it. If you get exceptions, always
copy'n'paste the traceback here. People might know what the exception
means and share their wisdom.

Marc 'BlackJack' Rintsch
Jul 13 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.