0

Afternoon,

I'm attempting to use curses, and one of my requirements for this script is to accept large amounts of data. The data is meant to be pasted in, and while usually is only a few thousand lines, it could easily grow to tens of thousands. My issue seems to be that my input is limited to the size of my window?

Ex:

begin_x = 0
begin_y = 0
height = 15
width = 30
window = curses.newwin(height, width, begin_y, begin_x)

c = window.getstr()
stdscr.addstr(0, 0, str(c.count(b'a')), curses.color_pair(1))
stdscr.refresh()

That provides me with the output of 449 when i type in as many 'a' characters as I'm allowed.

Is there a way to bump this up? I attempted setting the window larger, but still hit a maximum of 1024.

Justin Popa
  • 95
  • 1
  • 7

1 Answers1

0

getkey to the rescue!

Here's what I came up with:

d = ''

newline = 0
while newline == 0:
    c = window.getkey()
    if c == '\n':
        newline = 1
    else:
        d = d + c

d is a string, c is the results from getkey (a 1 character string) if it receives newline, quit. If not, keep looping til we get newline.

Justin Popa
  • 95
  • 1
  • 7