Re: HEKLP

2021-01-15 Thread Terry Reedy
On 1/16/2021 12:23 AM, Z3PS1 wrote: NEED HELP WITH MY IDLE Sent from [1]Mail for Windows 10 References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 I answer real IDLE questions, but this looks like spam to drive traffic to the hidden link, so I am ignoring i

HEKLP

2021-01-15 Thread Z3PS1
NEED HELP WITH MY IDLE   Sent from [1]Mail for Windows 10   References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 -- https://mail.python.org/mailman/listinfo/python-list

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
My previous code didn't work if the terminfo entities contained delay specifiers because the delay specifier was left in the output datastream. The case where the terminfo description contains delays, but the delays aren't needed can be handled by simply removing the delay specifiers by wrapping nc

Re: count consecutive elements

2021-01-15 Thread Tim Chase
On 2021-01-16 03:32, Bischoop wrote: >> The OP didn't specify what should happen in that case, so it would >> need some clarification. > > In that case maybe good solution would be to return three of them? That's the solution I chose in my initial reply, you get a tuple back of ([list of longest

Re: binascii.b2a vs ord()

2021-01-15 Thread Bischoop
On 2021-01-10, Chris Angelico wrote: > > Hope that helps! > Yep, now it seems more understandable what is going on. Thanks for you time. -- Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-16, Cameron Simpson wrote: > On 15Jan2021 18:36, Alan Gauld wrote: >>> One difference is that the name prompt is being written to stdout in >>> the C version and stderr in the Python version. But I don't see why >>> that would matter. >> >>That could make a big difference, the putp() f

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-16, Greg Ewing wrote: > On 16/01/21 7:33 am, Grant Edwards wrote: > >> Starting in Python 3., python's stdio file objects are _not_ >> on top of the libc FILE streams: they're directly on top of the file >> descriptor. > > This sounds like rather a bad situation, because it means that >

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-16, Chris Angelico wrote: > On Sat, Jan 16, 2021 at 1:36 PM Greg Ewing > wrote: > >> Can something be done about this? Maybe Python stdio objects >> should flush all the C stdio streams before writing anything? >> > > Surely it should be the other way around? If you use the C stdio >

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Grant Edwards wrote: > On 2021-01-15, Grant Edwards wrote: > >> Entities that are parameterized (e.g. goto location) would need to be >> passed through curses.tiparm() before they're decoded and printed. I'm >> goign to try that next. > > The curses module doesn't expose tiparm, bu

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, Terry Reedy wrote: IDLE's settings dialog uses a ttk.Notebook. The file is Lib/idlelib/configdialog.py. Thanks, Terry! I completely forgot that. I'll study the IDLE's code and learn from that. Stay well, Rich -- https://mail.python.org/mailman/listinfo/python-list

Re: count consecutive elements

2021-01-15 Thread Bischoop
On 2021-01-14, Tim Chase wrote: > > seems to only return one value so seems to get odd results if I > specify something like > > get_longest("aaabcccbbb") > > which at least here tells me that "c" is the longest run, even though > aaa, bbb, and ccc are all runs of length 3. The OP didn't specif

Re: Exploring terminfo

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 2:16 PM Greg Ewing wrote: > > On 16/01/21 3:37 pm, Chris Angelico wrote: > > Surely it should be the other way around? If you use the C stdio > > streams, flush them after use. > > 1. You might not know that you're (implicitly) using C stdio. > > 2. There doesn't seem to be

Re: Exploring terminfo

2021-01-15 Thread Greg Ewing
On 16/01/21 3:37 pm, Chris Angelico wrote: Surely it should be the other way around? If you use the C stdio streams, flush them after use. 1. You might not know that you're (implicitly) using C stdio. 2. There doesn't seem to be an easy way to flush C stdio from Python any more. -- Greg -- ht

Re: Exploring terminfo

2021-01-15 Thread Cameron Simpson
On 15Jan2021 18:36, Alan Gauld wrote: >> One difference is that the name prompt is being written to stdout in >> the C version and stderr in the Python version. But I don't see why >> that would matter. > >That could make a big difference, the putp() function specifically >states that it writes to

Re: why sqrt is not a built-in function?

2021-01-15 Thread Greg Ewing
On 16/01/21 10:14 am, Michael F. Stemper wrote: I had no idea that syntax existed, and find it completely at odds with The Zen of Python. It's not an *obvious* way, so there's no Zen conflict. As for why it exists, it's part of the mechanism that implements imports -- 'import' statements get c

Re: Exploring terminfo

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 1:36 PM Greg Ewing wrote: > > On 16/01/21 7:33 am, Grant Edwards wrote: > > Starting in Python 3., python's stdio file objects are _not_ > > on top of the libc FILE streams: they're directly on top of the file > > descriptor. > > This sounds like rather a bad situation, bec

Re: Exploring terminfo

2021-01-15 Thread Greg Ewing
On 16/01/21 7:33 am, Grant Edwards wrote: Starting in Python 3., python's stdio file objects are _not_ on top of the libc FILE streams: they're directly on top of the file descriptor. This sounds like rather a bad situation, because it means that any C library using stdio is going to interact b

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Terry Reedy
On 1/15/2021 3:51 PM, Rich Shepard wrote: I want to replace the menu on my application with the more appropriate notebook. After looking at examples in my reference books and on the Web I still cannot get it working properly. IDLE's settings dialog uses a ttk.Notebook. The file is Lib/idlelib

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread MRAB
On 2021-01-16 00:16, Rich Shepard wrote: On Fri, 15 Jan 2021, Rich Shepard wrote: Progress: I didn't put the notebook on the main window using grid. Now I need to find how to specify the position so it's at the top of the window. I'll read the options on grid. The notebook tabs are placed on

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, Rich Shepard wrote: Progress: I didn't put the notebook on the main window using grid. Now I need to find how to specify the position so it's at the top of the window. I'll read the options on grid. The notebook tabs are placed on the grid as nb.grid(row=0, column=0, colum

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 10:18 AM dn via Python-list wrote: > >> I am confuzzed. > > > > It's a common condition. > > There are three components: > 1 From the Greek: "con" meaning 'against' or 'unable'. > 2 From tech-jargon (and the Australian habit of shortening every word in > the English languag

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 16/01/2021 11.40, Michael F. Stemper wrote: > On 15/01/2021 16.01, Chris Angelico wrote: >> On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper >> wrote: >>> >>> On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: > On 15/01/2021 14.01, Stefan Ram wrote: > >> __imp

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, Rich Shepard wrote: The file 'application.py' is attached. If I had better docs here I could probably work a lot of this out by myself. Progress: I didn't put the notebook on the main window using grid. Now I need to find how to specify the position so it's at the top of t

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 9:47 AM Michael F. Stemper wrote: > > On 15/01/2021 16.01, Chris Angelico wrote: > > On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper > > wrote: > >> > >> On 15/01/2021 15.26, Stefan Ram wrote: > >>> "Michael F. Stemper" writes: > On 15/01/2021 14.01, Stefan Ram w

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 16.01, Chris Angelico wrote: On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: __import__( "math" ).sqrt( 4 ) I had no idea that syntax existed, and find it c

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 15/01/2021 06.44, Denys Contant wrote: > I don't understand why sqrt is not a built-in function. > Why do we have to first import the function from the math module? > I use it ALL THE TIME! > > That felt good. Thank you. Are you 'venting', or do you have a specific frustration-induced questi

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Grant Edwards wrote: > Entities that are parameterized (e.g. goto location) would need to be > passed through curses.tiparm() before they're decoded and printed. I'm > goign to try that next. The curses module doesn't expose tiparm, but you can use tparm instead: #!/usr/bin/p

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, Dennis Lee Bieber wrote: Off-hand, I'd suspect you should be adding these to the NOTEBOOK object "n". Dennis, You're correct. The MWE didn't have the proper syntax. Now, the problem is the notebook doesn't display its tabs on the main window, while the proper syn

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 9:25 AM Eli the Bearded <*@eli.users.panix.com> wrote: > > In comp.lang.python, Chris Angelico wrote: > > Michael F. Stemper wrote: > >> On 15/01/2021 14.01, Stefan Ram wrote: > >>> __import__( "math" ).sqrt( 4 ) > >> I had no idea that syntax existed, and find it complet

Re: why sqrt is not a built-in function?

2021-01-15 Thread Eli the Bearded
In comp.lang.python, Chris Angelico wrote: > Michael F. Stemper wrote: >> On 15/01/2021 14.01, Stefan Ram wrote: >>> __import__( "math" ).sqrt( 4 ) >> I had no idea that syntax existed, and find it completely at odds >> with The Zen of Python. I'm torn between forgetting that I ever saw >> it an

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Grant Edwards wrote: > On 2021-01-15, Alan Gauld via Python-list wrote: >> On 15/01/2021 17:31, Grant Edwards wrote: >> >>> I suspect that the problem is that putp is writing to the libc >>> "stdout" FILE stream that's declaredin . That stream >>> layer/object has buffering that is

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Alan Gauld via Python-list wrote: > On 15/01/2021 17:31, Grant Edwards wrote: > cur.putp(cls) name = input("Hello, what's your name? ") cur.putp(bold) print("Nice to meet you ", name) > > >>> putp(clr); >>> putp(bold); >>> printf("Enter a name: "

Re: How to flush 's stdout stream?

2021-01-15 Thread Grant Edwards
On 2021-01-15, Eryk Sun wrote: > On 1/15/21, Grant Edwards wrote: >> In Python 3.7+, how does one flush the stdout FILE stream? I mean the >> FILE *declared as 'stdio' in . I'm _not_ asking how to flush the >> Python file object sys.stdio. > > You can flush all output streams via C fflush(NULL).

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 16/01/2021 10.49, Michael F. Stemper wrote: ... > Es ist Feierabend You had me there for a moment, because spotting a 'double meaning" (actually triple) my mind succumbing to dissonance, refused to translate (into English), instead latching onto the last two syllables:- At one time, tech-jar

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: > > On 15/01/2021 15.26, Stefan Ram wrote: > > "Michael F. Stemper" writes: > >> On 15/01/2021 14.01, Stefan Ram wrote: > >>> __import__( "math" ).sqrt( 4 ) > >> I had no idea that syntax existed, and find it completely at odds > >> with T

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: __import__( "math" ).sqrt( 4 ) I had no idea that syntax existed, and find it completely at odds with The Zen of Python. I'm torn between forgetting that I ever saw it and using it for s

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, MRAB wrote: You should be adding the frames to the notebook. Also, the tabs are 'self.tab1', not 'tab1', etc: n.add(self.tab1, text='Activities') Similarly for the others. Thanks. MRAB. This allows me to move on and put pre-built widget pages on the tabs. Regards

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread MRAB
On 2021-01-15 20:51, Rich Shepard wrote: I want to replace the menu on my application with the more appropriate notebook. After looking at examples in my reference books and on the Web I still cannot get it working properly. Here's a small example (nbtest.py): ---8< --- #!/us

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 8:16 AM Michael F. Stemper wrote: > > On 15/01/2021 14.01, Stefan Ram wrote: > > "Michael F. Stemper" writes: > > >> Of these, only EcmaScript has > >> Math.sqrt() as part of the language, and that could be partly > >> due to the fact that the

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.01, Stefan Ram wrote: "Michael F. Stemper" writes: Of these, only EcmaScript has Math.sqrt() as part of the language, and that could be partly due to the fact that the language doesn't have any concept of "import" or "include". You do not ne

Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
I want to replace the menu on my application with the more appropriate notebook. After looking at examples in my reference books and on the Web I still cannot get it working properly. Here's a small example (nbtest.py): ---8< --- #!/usr/bin/env python3 import tkinter as tk fr

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 7:45 AM Michael F. Stemper wrote: > > Languages differ. I don't see why it's so important to focus on just > > one thing - and to complain that, even though it's in the standard > > library, you have to use an import command to get it. > > You should probably direct this to

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.02, Chris Angelico wrote: On Sat, Jan 16, 2021 at 6:21 AM Michael F. Stemper wrote: Here's the status of the square root function in various languages, in the order that I encountered them: FORTRANPart of the language Pascal Part of the language SNOBOL Part of the

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Alan Gauld via Python-list wrote: > On 15/01/2021 17:31, Grant Edwards wrote: > >> I suspect that the problem is that putp is writing to the libc >> "stdout" FILE stream that's declaredin . That stream >> layer/object has buffering that is invisible to Python. > > That would indeed

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Green
Michael F. Stemper wrote: > On 14/01/2021 13.00, Rob Cliffe wrote: > > On 14/01/2021 17:44, Denys Contant wrote: > > >> I don't understand why sqrt is not a built-in function. > >> Why do we have to first import the function from the math module? > >> I use it ALL THE TIME! > > I agree that, espe

Re: How to flush 's stdout stream?

2021-01-15 Thread Eryk Sun
On 1/15/21, Grant Edwards wrote: > In Python 3.7+, how does one flush the stdout FILE stream? I mean the > FILE *declared as 'stdio' in . I'm _not_ asking how to flush the > Python file object sys.stdio. You can flush all output streams via C fflush(NULL). If it has to be just stdout, the code wi

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.00, Chris Green wrote: Michael F. Stemper wrote: On 14/01/2021 13.00, Rob Cliffe wrote: On 14/01/2021 17:44, Denys Contant wrote: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE TIME!

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 6:21 AM Michael F. Stemper wrote: > Here's the status of the square root function in various languages, > in the order that I encountered them: > > FORTRANPart of the language > Pascal Part of the language > SNOBOL Part of the language > c Need to #incl

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 14/01/2021 13.00, Rob Cliffe wrote: On 14/01/2021 17:44, Denys Contant wrote: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE TIME! I agree that, especially if you have experience in other languages,

How to flush 's stdout stream?

2021-01-15 Thread Grant Edwards
In Python 3.7+, how does one flush the stdout FILE stream? I mean the FILE *declared as 'stdio' in . I'm _not_ asking how to flush the Python file object sys.stdio. The problem is that some Python modules write to FILE *stdio, but don't flush the stream so that the data gets written to the standar

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 15/01/2021 17:31, Grant Edwards wrote: >>> cur.putp(cls) >>> name = input("Hello, what's your name? ") >>> >>> cur.putp(bold) >>> print("Nice to meet you ", name) >> putp(clr); >> putp(bold); >> printf("Enter a name: "); >> fgets(line, sizeof(line),stdin); >> >> printf("He

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Grant Edwards wrote: > I suspect that the problem is that putp is writing to the libc > "stdout" FILE stream that's declaredin . That stream > layer/object has buffering that is invisible to Python. Python's > sys.stdout.flush() is flushing the Python file object's output buffers >

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Alan Gauld via Python-list wrote: > On 14/01/2021 16:12, Alan Gauld via Python-list wrote: > >> # >> import curses as cur >> cur.setupterm() >> >> bold = cur.tigetstr('bold') >> cls = cur.tigetstr('clear') >> >> cur.putp(cls) >> name = input("Hello, what's your nam

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 16:12, Alan Gauld via Python-list wrote: > # > import curses as cur > cur.setupterm() > > bold = cur.tigetstr('bold') > cls = cur.tigetstr('clear') > > cur.putp(cls) > name = input("Hello, what's your name? ") > > cur.putp(bold) > print("Nice to meet you ", name) >

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 22:11, Grant Edwards wrote: > Or use a terminfo library: > > https://github.com/DirectXMan12/py-terminfo > > It _may_ be possible to use ncurses to get the terminfo strings > required for various functions without actually having ncurses to any > I/O, but I've never tried that...

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 23:08, Grant Edwards wrote: > Alternatively, I think you can use the ncurses library to retrieve the control > strings (just don't use any ncurses input/output calls), like this example > from > https://stackoverflow.com/questions/6199285/tput-cup-in-python-on-the-commandline: > >

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 21:30, Barry Scott wrote: >> During lockdown I've been digging deeper into the curses module >> and lately into the ti family of functions that reside there. > It seems that curses does not allow you to mix raw stdin/stdout with its > calls. That's true of curses after you cal

Re: why sqrt is not a built-in function?

2021-01-15 Thread Rob Cliffe via Python-list
On 14/01/2021 17:44, Denys Contant wrote: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE TIME! I agree that, especially if you have experience in other languages, this feels odd, and I have some sympath