I am attempting to create an ASCII level editor in Python using curses
but I'm having issues. I get Traceback (most recent call last): File "lvleditor_curses.py", line 36, in <module> editor.newLine() File "lvleditor_curses.py", line 31, in newLine self.stdscr.addstr(self.level[0][0]) TypeError: expect bytes or str, got int
when using the following code.
import os, curses
class Editor:
def __init__(self):
self.stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
self.stdscr.keypad(True)
self.stdscr.addstr("test")
self.stdscr.refresh()
self.level = []
def newLine(self):
line = self.stdscr.getstr()
self.level += [list(line)]
self.stdscr.addstr(self.level[0][0])
self.stdscr.refresh()
editor = Editor()
editor.newLine()