Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!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; 'raises': 0.07; 'cursor': 0.09; 'exception,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Python3': 0.09; 'terry': 0.09; 'ignore': 0.13; 'curses': 0.16; 'disabled.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'char': 0.17; 'module,': 0.17; 'jan': 0.18; 'otherwise,': 0.20; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'header:X-Complaints-To:1': 0.28; 'character': 0.29; 'position.': 0.30; 'problem.': 0.32; 'getting': 0.33; 'skip:s 30': 0.33; 'scroll': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'text': 0.34; 'screen': 0.34; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'problems': 0.36; 'possible': 0.37; 'beyond': 0.37; 'being': 0.37; 'subject:: ': 0.38; 'possible.': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'movement': 0.62; 'strange': 0.62; 'behavior': 0.64; 'here': 0.65; 'moves': 0.84; 'received:fios.verizon.net': 0.84; 'why?': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Python3 curses behavior Date: Sat, 09 Feb 2013 14:22:47 -0500 References: <3adc871c-9a35-42ea-9687-52413d72a918@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: <3adc871c-9a35-42ea-9687-52413d72a918@googlegroups.com> 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: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360437812 news.xs4all.nl 6859 [2001:888:2000:d::a6]:46076 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38536 On 2/9/2013 6:23 AM, Vlasov Vitaly wrote: > Hello. > > I found strange behavior of curses module, that i can't understand. I > initialize screen with curses.initscr(), then i create subwin of > screen with screen.subwin(my_subwin_sizes). After that i fill subwin > with my_char in for-loop. On last char in last line subwin.addch() > raises exception. I have never used curses but I have used text screens. I suspect that=20 addch moves the cursor to the position beyond where the character is=20 added, but there is no such position. I remember having problems writing = to the last char of a 24x80 screen without getting either a scroll or=20 beep if scrolling was disabled. > This is my problem. Why? How to fix it? Perhaps this will help: window.leaveok(yes) If yes is 1, cursor is left where it is on update, instead of being at=20 =E2=80=9Ccursor position.=E2=80=9D This reduces cursor movement where pos= sible. If=20 possible the cursor will be made invisible. > (If i will ignore exception, then last char will be displayed) Otherwise, just catch the exception, as you already discovered. > Here simple example: http://pastebin.com/SjyMsHZB --=20 Terry Jan Reedy