Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'initialize': 0.05; 'exception.': 0.07; 'newline': 0.07; 'raises': 0.07; 'cursor': 0.09; 'exception,': 0.09; 'option:': 0.09; 'subject:Python3': 0.09; 'terry': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'ignore': 0.13; 'curses': 0.16; 'disabled.': 0.16; 'reedy': 0.16; 'try/except': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'char': 0.17; 'module,': 0.17; 'script.': 0.17; 'jan': 0.18; 'otherwise,': 0.20; 'skip:\xd1 10': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'character': 0.29; 'position.': 0.30; 'problem.': 0.32; 'getting': 0.33; 'skip:s 30': 0.33; 'scroll': 0.33; 'skip:\xd0 10': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'text': 0.34; 'screen': 0.34; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'test': 0.36; 'thank': 0.36; 'problems': 0.36; 'possible': 0.37; 'beyond': 0.37; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'possible.': 0.38; 'instead': 0.39; 'where': 0.40; 'you.': 0.61; 'movement': 0.62; 'strange': 0.62; 'behavior': 0.64; 'here': 0.65; '8bit%:100': 0.70; 'moves': 0.84; 'why?': 0.84 X-Received: by 10.49.75.195 with SMTP id e3mr848037qew.24.1360533960308; Sun, 10 Feb 2013 14:06:00 -0800 (PST) Newsgroups: comp.lang.python Date: Sun, 10 Feb 2013 14:06:00 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.143.44.204; posting-account=HJeeUwoAAACqQZf2_3yuey8U4o2rTRn3 References: <3adc871c-9a35-42ea-9687-52413d72a918@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 94.143.44.204 MIME-Version: 1.0 Subject: Re: Python3 curses behavior From: Vlasov Vitaly To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 77 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360533970 news.xs4all.nl 6922 [2001:888:2000:d::a6]:39612 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38608 =D1=81=D1=83=D0=B1=D0=B1=D0=BE=D1=82=D0=B0, 9 =D1=84=D0=B5=D0=B2=D1=80=D0= =B0=D0=BB=D1=8F 2013=C2=A0=D0=B3., 23:22:47 UTC+4 =D0=BF=D0=BE=D0=BB=D1=8C= =D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Terry Reedy =D0=BD=D0=B0= =D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > On 2/9/2013 6:23 AM, Vlasov Vitaly wrote: >=20 > > Hello. >=20 > > >=20 > > I found strange behavior of curses module, that i can't understand. I >=20 > > initialize screen with curses.initscr(), then i create subwin of >=20 > > screen with screen.subwin(my_subwin_sizes). After that i fill subwin >=20 > > with my_char in for-loop. On last char in last line subwin.addch() >=20 > > raises exception. >=20 >=20 >=20 > I have never used curses but I have used text screens. I suspect that=20 >=20 > addch moves the cursor to the position beyond where the character is=20 >=20 > added, but there is no such position. I remember having problems writing= =20 >=20 > to the last char of a 24x80 screen without getting either a scroll or=20 >=20 > beep if scrolling was disabled. >=20 >=20 >=20 > > This is my problem. Why? How to fix it? >=20 >=20 >=20 > Perhaps this will help: >=20 > window.leaveok(yes) >=20 > If yes is 1, cursor is left where it is on update, instead of being at=20 >=20 > =E2=80=9Ccursor position.=E2=80=9D This reduces cursor movement where pos= sible. If=20 >=20 > possible the cursor will be made invisible. >=20 >=20 >=20 > > (If i will ignore exception, then last char will be displayed) >=20 >=20 >=20 > Otherwise, just catch the exception, as you already discovered. >=20 >=20 >=20 > > Here simple example: http://pastebin.com/SjyMsHZB >=20 >=20 >=20 > --=20 >=20 > Terry Jan Reedy Thank you. I tried everything in my test script. win.leaveok() - no effect curses.cur_vis() - no effect win.scrollok() - start newline and place cursor on it It's only one last option: on last line last char try/except with pass.