> -----Original Message----- > From: Alan Gauld <alan.ga...@yahoo.co.uk> > Sent: Sunday, May 30, 2021 4:38 PM > To: python-list@python.org > Subject: Re: How to debug python + curses? [was: RE: Applying winpdb_reborn] > > On 30/05/2021 18:26, pjfarl...@earthlink.net wrote: > > I tried winpdb-reborn some time last year on my Win10 system (python > > 3.8.3 at that time), but could not figure out how to use it to debug a > > python script that uses the curses module. > > You are not alone. debugging curses is one of the biggest obstacles to its > use. > > My approach is to define a status line at the bottom of my program and write > print statements into that window. Something like: > > def main(stdwin): > appwin = curses.newwin(...) # LINES-1 high > status = curses.newwin(...) # 1 line high positioned on bottom > # more code here > status.addstr(0,0, "Value of foo = %s" % foo) > > curses.wrapper(main) > > After debugging the status window can either be retained as an application > status bar or removed and the main window enlarged by one line... > > If anyone else has found a better way to debug curses code I'm also keen to > hear!
Thanks Alan, interesting idea. And it will work whether you are running in a Windows system or a *ix one. Peter -- https://mail.python.org/mailman/listinfo/python-list