Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-17 Thread Alan Gauld via Python-list
On 15/01/2025 00:41, Keith Thompson via Python-list wrote: > Alan Gauld writes: >> On 11/01/2025 14:28, Chris Green via Python-list wrote: >>> I'm looking for Python packages that can help with text mode input, >> >> The standard package for this is curses which comes as part >> of the standard li

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-15 Thread Alan Gauld via Python-list
On 15/01/2025 00:54, Grant Edwards via Python-list wrote: > are your friend. If that's not sophisticated enough the gnu "readline" > library with a simple command processor is a common next step. On that front the cmd module in Python is often overlooked but is useful for structuring a non-GUI-li

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-14 Thread Alan Gauld via Python-list
On 14/01/2025 00:20, Grant Edwards via Python-list wrote: > On 2025-01-13, Alan Gauld via Python-list wrote: > >> All of that is possible in curses, you just have to code it. > > All of that is easy with curses in C. Unfortunately, the high level > "panel" and &q

RE: Tools to help with text mode (i.e. non-GUI) input

2025-01-13 Thread Alan Gauld via Python-list
On 11/01/2025 14:28, Chris Green via Python-list wrote: > I'm looking for Python packages that can help with text mode input, The standard package for this is curses which comes as part of the standard library on *nix distros. > What I'm specifically after is a way to provide a default value that

Re: TkInter Scrolled Listbox class?

2024-11-04 Thread Alan Gauld via Python-list
On 04/11/2024 15:32, Ulrich Goebel via Python-list wrote: > I would like to build a class ScrolledListbox, I assume like the one that used to be available via the Tix module? It's a great shame that Tix is gone, it had a lot of these useful widgets, but they were all wrappers around Tcl/Tk's Tix

Re: Printing UTF-8 mail to terminal

2024-10-31 Thread Alan Gauld via Python-list
On 31/10/2024 20:50, Cameron Simpson via Python-list wrote: > That looks to me like quoted-printable. This is an encoding for binary > transport of text to make it robust against not 8-buit clean ... > If you're just dealing with this directly, use the `quopri` stdlib > module: https://docs.py

Re: bring back nntp library to python3

2024-08-14 Thread Alan Gauld via Python-list
On 14/08/2024 23:32, Left Right via Python-list wrote: >> it became simple and straightforward to >> download and install packages. > > I think the right word for this is "delusional". I agree. But even if it worked it doesn't alter the fact that by not having batteries included it puts the onus

Re: Best use of "open" context manager

2024-07-06 Thread Alan Gauld via Python-list
On 06/07/2024 11:49, Rob Cliffe via Python-list wrote: >     If the file does not exist I want to take appropriate action, e.g. > print an error message and abort the program. > I might write it like this: > > try: >     with open(FileName) as f: >         for ln in f: >             print("I

Re: IDLE: clearing the screen

2024-06-09 Thread Alan Gauld via Python-list
On 08/06/2024 20:18, Rob Cliffe via Python-list wrote: > OK, here is the advanced version: > import os > class _cls(object): >     def __repr__(self): >         os.system('cls') >         return '' > cls = _cls() > > Now when you type > cls > it clears the screen.  For me on a Mac it clears t

Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-19 Thread Alan Gauld via Python-list
On 18/05/2024 19:12, Piergiorgio Sartor via Python-list wrote: >> So venvs make managing all that pretty convenient. Dunno why everybody's >> so down on venvs... Not so much down on them, they are just one extra step that's mostly not needed(in my use case) > Only people which are *not* using p

Re: Terminal Emulator

2024-05-14 Thread Alan Gauld via Python-list
On 14/05/2024 18:44, Gordinator via Python-list wrote: > I wish to write a terminal emulator in Python. I am a fairly competent > Python user, and I wish to try a new project idea. What references can I > use when writing my terminal emulator? I wish for it to be a true > terminal emulator as we

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Alan Gauld via Python-list
On 10/04/2024 19:50, WordWeaver Evangelist via Python-list wrote: > I have a simple question. I use the following textPrompt in some of my Jython > modules: > '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, > forceUppercase=True) > Is there a way to add an ANSI color cod

Re: xkcd.com/353 ( Flying with Python )

2024-03-30 Thread Alan Gauld via Python-list
On 30/03/2024 07:04, Greg Ewing via Python-list wrote: > On 30/03/24 7:21 pm, HenHanna wrote: >> https://xkcd.com/1306/ >> what does  SIGIL   mean? > > I think its' a Perl term, referring to the $/@/# symbols in front of > identifiers. There seem to be several derivation

Re: Error in Module

2024-03-11 Thread Alan Gauld via Python-list
On 10/03/2024 18:08, Sanskar Mukeshbhai Joshi via Python-list wrote: > I had made my project in BCA in Python. When I had complete my > project and run the program, at that time I got the error in > runnig my project. The error was ModuleNotFoundError: No module named 'flask'. Flask is a third

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Alan Gauld via Python-list
On 05/03/2024 22:46, Grant Edwards via Python-list wrote: > Unfortunately (presumably thanks to SEO) the enshittification of > Google has reached the point where searching for info on things like > Python name scope, the first page of links are to worthless sites like > geeksforgeeks. And not just

Re: RE: Problem resizing a window and button placement

2024-02-27 Thread Alan Gauld via Python-list
On 27/02/2024 07:13, Steve GS via Python-list wrote: > Aside from using it to resized > the window, is there no way to > know the last value of the > change for use in the program? The last value would be the current width. And you know how to get that as shown in your configure function: Ww = r

Re: RE: RE: Problem resizing a window and button placement

2024-02-26 Thread Alan Gauld via Python-list
On 26/02/2024 11:02, Steve GS via Python-list wrote: > Although your code produces the value of Ww outside the function, > I do not see how I can use the value of Ww unless I close the program. You have to use a function that operates inside the mainloop. Thats the nature of event driven programs

Re: RE: Problem resizing a window and button placement

2024-02-26 Thread Alan Gauld via Python-list
On 26/02/2024 07:56, Steve GS via Python-list wrote: > Then there is that discovery > element: Why is my original > idea not working? I still > cannot pass the value back > from the function. What is > different about this function > that others would have given > me the value? There is nothing

Re: RE: Problem resizing a window and button placement

2024-02-25 Thread Alan Gauld via Python-list
On 25/02/2024 03:58, Steve GS via Python-list wrote: import tkinter as tk Ww = None def on_configure(*args): global Ww Ww = root.winfo_width() print("Ww Inside = <" + str(Ww) + ">") root = tk.Tk() root.bind('', on_configure) root.mainloop() print("Ww Outside = <" + str(Ww)

Re: Using my routines as functions AND methods

2024-01-04 Thread Alan Gauld via Python-list
On 04/01/2024 04:17, Thomas Passin via Python-list wrote: >> I'm probably missing something obvious here but can't you >> just assign your function to a class member? >> >> def myFunction(obj, ...): ... >> >> class MyClass: >> myMethod = myFunction > > That works if you assign the function t

Re: Using my routines as functions AND methods

2024-01-03 Thread Alan Gauld via Python-list
On 03/01/2024 22:47, Guenther Sohler via Python-list wrote: > Hi, > > In my cpython i have written quite some functions to modify "objects". > and their python syntax is e.g.\ > > translate(obj, vec). e.g whereas obj is ALWAYS first argument. > However, I also want to use these functions as clas

Re: Are there any easy-to-use Visual Studio C# WinForms-like GUI designers in the Python world for Tk?

2023-12-30 Thread Alan Gauld via Python-list
On 29/12/2023 01:05, Félix An via Python-list wrote: > I'm used to C# WinForms, which has an easy-to-use drag-and-drop GUI > designer in Visual Studio. Is there anything similar for Tk? How about > Qt? There are any number of them but few that work well. The best I found was Dabo but it uses it

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread Alan Gauld via Python-list
On 25/12/2023 05:34, geetanajali homes via Python-list wrote: >> import numpy as np >> import pandas as pd >> import random >> import matplotlib.pyplot as plt >> %matplotlib inline >> >> I get an error on the last line. I am running this code in Idle Python >> 3.4.4 Shell... Python names c

Re: Amy known issues with tkinter /ttk on latest MacOS?

2023-11-19 Thread Alan Gauld via Python-list
On 17/11/2023 03:38, Terry Reedy wrote: > There have been other reports on the cpython issue tracker than Sonoma > broke bits of tk behavior. > https://github.com/python/cpython/issues?q=is%3Aissue+label%3AOS-mac+is%3Aclosed > > shows a couple Thanks Terry, I had a browse and it seems I'm no

Amy known issues with tkinter /ttk on latest MacOS?

2023-11-16 Thread Alan Gauld via Python-list
I have a little app that I wrote ages ago (2015) using tkinter/ttk and it just works. Or it did, up until the latest MacOS version upgrade and now it has become very sporadic in response to mouse clicks. For example I have a drop-down list and I can drop the list but then it won't let me select an

Re: Newline (NuBe Question)

2023-11-15 Thread Alan Gauld via Python-list
On 15/11/2023 07:25, Grizzy Adams via Python-list wrote: > for s in students: > grades.append(s.school) > grades.append(s.name) > grades.append(s.finalGrade()) > if s.finalGrade()>82: > grades.append("Pass") >

Re: xor operator

2023-11-13 Thread Alan Gauld via Python-list
On 14/11/2023 00:33, Mats Wichmann via Python-list wrote: > Hardware and software people may have somewhat different views of xor I've come at it from both sides. I started life as a telecomms technician and we learned about xor in the context of switching and relays and xor was a wiring configura

Re: Question(s)

2023-10-25 Thread Alan Gauld via Python-list
On 25/10/2023 12:44, o1bigtenor via Python-list wrote: > Haven't heard of a python IDE - - - doesn't mean that there isn't such - - There are literally dozens with varying degrees of smartness. The big 4 all have Python plugins/environments: Eclipse, Netbeans, VisualStudio, IntelliJ And of cours

Re: Question(s)

2023-10-24 Thread Alan Gauld via Python-list
On 25/10/2023 00:08, o1bigtenor via Python-list wrote: > So how does one test software then? Testing is very different to proving! As an industry we do a lot of testing at many different levels. On bigger projects you'll find: - Unit tests - testing small fragments of a bigger program - Integrati

Re: Question(s)

2023-10-24 Thread Alan Gauld via Python-list
On 24/10/2023 22:51, Grant Edwards via Python-list wrote: >>> Is there a way to verify that a program is going to do what it is >>> supposed to do even before all the hardware has been assembled and >>> installed and tested? > And the specified customer requirements are usually wrong too. Sure, >

Re: Why doc call `__init__` as a method rather than function?

2023-09-15 Thread Alan Gauld via Python-list
On 15/09/2023 11:49, scruel tao via Python-list wrote: > ```python class A: > ... def __init__(self): > ... pass > On many books and even the official documents, it seems that > many authors prefer to call `__init__` as a "method" rather > than a "function". That' because in OOP term

Re: Why do I always get an exception raised in this __init__()?

2023-09-01 Thread Alan Gauld via Python-list
On 31/08/2023 22:15, Chris Green via Python-list wrote: > class Gpiopin: > > def __init__(self, pin): > # > # > # scan through the GPIO chips to find the line/pin we want > # > for c in ['gpiochip0', 'gpiochip1', 'gpioch

Re: Multiple inheritance and a broken super() chain

2023-07-05 Thread Alan Gauld via Python-list
On 05/07/2023 01:27, Chris Angelico via Python-list wrote: >> So I'm curious about how big this "big problem with MI" is in > > Who said it's a big problem with MI? I think it's a very common perception, particularly with newer programmers who have never used it in anger. Any time anyone discus

Re: Multiple inheritance and a broken super() chain

2023-07-04 Thread Alan Gauld via Python-list
On 03/07/2023 19:39, Chris Angelico via Python-list wrote: > On Tue, 4 Jul 2023 at 03:39, Peter Slížik via Python-list >> The legacy code I'm working with uses a classic diamond inheritance. > What happens when Top is initialized twice? This seems like a problem > waiting to happen, and when you

Re: Fwd: AUTO EDITOR DIDN'T WORK

2023-06-15 Thread Alan Gauld via Python-list
On 15/06/2023 08:58, Real Live FootBall Tv via Python-list wrote: > I have followed the instructions given on how to install the app. What I > needed was an application to cut of silence from my video and I saw auto > editor demonstrated as one of the applications that could do that. It does > cut

Fwd: AUTO EDITOR DIDN'T WORK

2023-06-13 Thread Alan Gauld via Python-list
d and reinstalled about twice and still no success hence I uninstalled it. On Mon, 12 Jun 2023, 23:33 Alan Gauld via Python-list, mailto:python-list@python.org>> wrote: On 12/06/2023 10:26, Real Live FootBall Tv via Python-list wrote: > I did it because I was going to use it with another

Fwd: Re: AUTO EDITOR DIDN'T WORK

2023-06-12 Thread Alan Gauld via Python-list
On 12/06/2023 10:26, Real Live FootBall Tv via Python-list wrote: > I did it because I was going to use it with another application, A VIDEO > EDITING APP, Auto EDITOR but it didn't work for some reasons unknown to me. You need to define "didn't work" Did it work as a python interpreter? ie. Di

Re: Question again

2021-09-16 Thread Alan Gauld via Python-list
On 16/09/2021 06:50, af kh wrote: > Hello, > I was doing some coding on a website called replit I have no idea what that is but... > after answering 'no' or 'yes' after the last sentence I wrote, > the Python window shut off, That's what you told it to do in the code. Regardless of which answe

Re: Friday Finking: Contorted loops

2021-09-12 Thread Alan Gauld via Python-list
On 12/09/2021 09:11, jak wrote: > if the only way to terminate a 'while True' loop is by using the 'break' > statement, why is it allowed to add the 'else' statement which will only > contain dead code? > > while True: > break > else: > print('dead code') > Because to the interpreter

Re: Friday Finking: Contorted loops

2021-09-12 Thread Alan Gauld via Python-list
On 11/09/2021 15:41, Peter J. Holzer wrote: > How is C's do/while loop more horrible than Pascal's repeat/until? Because it is very hard to spot or distinguish from a normal while loop. while condition ; Is a valid (and fairly common) loop in C so code that has do{ code } while condition; L

Re: Friday Finking: Contorted loops

2021-09-11 Thread Alan Gauld via Python-list
On 10/09/2021 19:49, Stefan Ram wrote: > Alan Gauld writes: >> OK, That's a useful perspective that is at least consistent. >> Unfortunately it's not how beginners perceive it > ... > > Beginners perceive it the way it is explained to them by > their teacher. I'm not sure that's true. Most

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 10/09/2021 16:36, MRAB wrote: >> while...else... >> >> executes the else if the body of the loop does NOT get executed. >> >> for...else... >> >> executes the else iff ALL iterations of the for loop DO complete. >> > [snip] > > In both cases, it executes the 'else' part if it didn't break out

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 10/09/2021 00:47, Terry Reedy wrote: > even one loop is guaranteed.) "do-while" or "repeat-until is even rarer > since fractional-loop include this as a special case. Is there any empirical evidence to support this? Or is it just a case of using the tools that are available? In my experience

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 09/09/2021 22:36, dn via Python-list wrote: > Even in fairly modest Python constructs, we quickly repeal the one-in, > one-out philosophy because try...except operates by providing another > exit-path. Exceptions are exceptional by their nature (or should be!) As such they can arguably be excu

Re: on writing a while loop for rolling two dice

2021-09-07 Thread Alan Gauld via Python-list
On 07/09/2021 15:53, Grant Edwards wrote: > I remember engineering manager I worked with about 35 years ago who > used a set of C macros to try to make his code look as much like BASIC > as possible: > > #define IF if ( > #define THEN ) { > #define ELSE } else { > #define ENDIF } > ...

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-04 Thread Alan Gauld via Python-list
On 03/09/2021 18:37, Chris Angelico wrote: Without DST the schools opened in the dark so all the kids had to travel to school in the dark and the number of traffic accidents while crossing roads jumped. > > Are you saying that you had DST in winter, or that, when summer *and* > DST

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-03 Thread Alan Gauld via Python-list
On 02/09/2021 19:30, Chris Angelico wrote: >> Without DST the schools opened in the dark so all the kids >> had to travel to school in the dark and the number of >> traffic accidents while crossing roads jumped. > > How do they manage in winter? That was the winter. Sunrise wasn't till 10:00 or

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 02/09/2021 20:11, MRAB wrote: >> In one of them (I can't recall which is which) they change on the 4th >> weekend of October/March in the other they change on the last weekend. >> >> > In the EU (and UK) it's the last Sunday in March/October. > > In the US it's second Sunday in March and the f

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 02/09/2021 19:28, Chris Angelico wrote: >> Except for the places that don't follow the IANA scheme and/or >> dynamically change their time settings on a whim. To be complete >> you need the ability to manually override too. >> > > What places are those? Mainly small non-tech oriented places

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 23:31, Chris Angelico wrote: > Ah, good to know. I think that actually makes a lot of sense; in the > US, they try to let everyone pretend that the rest of the world > doesn't exist ("we always change at 2AM"), but in Europe, they try to > synchronize for the convenience of commerce

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 22:32, Chris Angelico wrote: > If we could abolish DST world-wide, life would be far easier. All the > rest of it would be easy enough to handle. We tried that in the UK for 2 years back in the '70s and very quickly reverted to DST when they realized that the number of fatalities amo

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 22:13, Chris Angelico wrote: > But ultimately, it all just means that timezones are too hard for > humans to handle, and we MUST handle them using IANA's database. It is > the only way. Except for the places that don't follow the IANA scheme and/or dynamically change their time sett

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Alan Gauld via Python-list
On 31/08/2021 13:45, Chris Angelico wrote: > (I find the Ireland situation particularly amusing. Time zones and daylight saving arrangements in particular are a nightmare at the micro level. I once worked on a large customer support application which required all dates/times to be viewable in UT

Python UI (was Re: urgent)

2021-08-30 Thread Alan Gauld via Python-list
On 29/08/2021 11:28, Hari wrote: > i was download ur python software but it is like boring user interface I agree it is a boring user interface. Just 3 chevrons: >>> You can change it a little if you want but ultimately its just an invitation to type commands. What kind of interface did you have

Re: on writing a while loop for rolling two dice

2021-08-28 Thread Alan Gauld via Python-list
On 28/08/2021 21:50, Hope Rouselle wrote: >>> roll_count = 0 >>> while True: >>> outcome = roll_two_dice() >>> roll_count += 1 >>> if outcome[ 0 ]== outcome[ 1 ]: break >>> return roll_count, outcome[ 0 ] >> > > Wait, I'm surprised ``outcome'' is still a valid name at the > return-sta

Re: tkinter

2021-08-21 Thread Alan Gauld via Python-list
On 21/08/2021 19:37, Tony Genter wrote: >Tkinter stopped working overnight from 8/20/2021 to 8/21/2021. Last night >I was working on tutorials to work on a GUI and this morning every file >that uses tkinter is broken stating that no module `tkinter' exists. Are you sure you were runni

Re: Tkinter widgets for desktop database application

2021-07-14 Thread Alan Gauld via Python-list
On 13/07/2021 21:24, Rich Shepard wrote: > What have other developers used for the UI on a stand-alone database > application not using a web browser? Mostly I just use a scrolledlistbox and a set of functions for formatting the data into columns for display. The big snag is you can't do spreads

Re: tkinter: tksheet

2021-06-17 Thread Alan Gauld via Python-list
On 17/06/2021 00:15, Rich Shepard wrote: > When I view my contacts table it needs to includes attributes from the > company, people, and contacts tables so I can view all prior contacts with > that person. Sounds like a job for a database view. Can you modify the database schema? Could you create

Re: tkinter: tksheet

2021-06-16 Thread Alan Gauld via Python-list
On 16/06/2021 21:45, Rich Shepard wrote: > The two applications I'm building are both database applications. If > tksheet() is not the most appropriate widget to display database tables what > alternative would be better? I've not used tksheet but it sounds like it might be worth investigating.

Re: Terminology: EU language skills, and Master to Main (or ...)

2021-06-14 Thread Alan Gauld via Python-list
On 13/06/2021 04:21, dn via Python-list wrote: > What do you think a professionally-recognisable series of skill-levels > for programmers? This has been done or attempted many times, with perhaps the most complete scheme being the British Computer Society's "Industry Standard Model" which breaks

Re: Tkinter8.6: date picker

2021-06-14 Thread Alan Gauld via Python-list
On 11/06/2021 22:20, Rich Shepard wrote: > I need a date picker +1 -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos -- https://mail.python.org/ma

Re: fabric: fab command

2021-06-02 Thread Alan Gauld via Python-list
On 02/06/2021 14:35, jayshankar nair via Python-list wrote: > import tools.fab.dev_utils as dev_utilsImportError: No module named > tools.fab.dev_utils > Please let me know which package i have to install. Work backwards. Can you import tools.fab? Can you import tools? Once you know what you do

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Alan Gauld via Python-list
On 01/06/2021 21:18, Rich Shepard wrote: > On Sun, 30 May 2021, Cameron Simpson wrote: > >> I've only just started with pdb. As of Python 3.7 there's a builtin >> function named breakpoint() which drops you into the debugger. > I'm stuck with neither approach (pdb, print()) working. > The act

Re: Definition of "property"

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 15:59, Dennis Lee Bieber wrote: > On Sun, 30 May 2021 21:20:24 +0100, Alan Gauld via Python-list > declaimed the following: > >> On 30/05/2021 17:57, Irv Kalb wrote: >>> I am doing some writing (for an upcoming book on OOP), and I'm a little >>&

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 16:16, Grant Edwards wrote: > On 2021-05-30, Alan Gauld via Python-list wrote: >> You are not alone. debugging curses is one of the biggest obstacles to >> its use. > > Can't you just run the debugger in a different window and attach to > the process

Re: Definition of "property"

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 01:24, Greg Ewing wrote: > On 31/05/21 8:20 am, Alan Gauld wrote: >> >> That's a very Pythonic description. > > If it's a book about Python, it needs to be. The word "property" > has a very specialised meaning in Python. > > In some other languages it's used the way we use "attribut

Re: Definition of "property"

2021-05-31 Thread Alan Gauld via Python-list
On 30/05/2021 23:57, Mike Dewhirst wrote: > > A property is an object method masquerading as a cachable object attribute Or a group of methods perhaps? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Fli

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-05-30 Thread Alan Gauld via Python-list
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

Re: Definition of "property"

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 17:57, Irv Kalb wrote: > I am doing some writing (for an upcoming book on OOP), and I'm a little > stuck. Oh dear, that's one of myt hot buttons I'm afraid! I hope it really is about OOP and not about classes. Classes are such a minor part of OOP that it is depressing how many boo

Re: Python doesn't work

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 12:23, Mr.Incognito wrote: >Hello > >I downloaded the latest versioon of Python and tried to open several .py >files, but it doesn't open. It opens for a sec, then closes itself. I >tried uninstalling and reinstalling, but it doesn't work. Most likely it is working b

Re: Applying winpdb_reborn

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 00:03, Cameron Simpson wrote: > I'd imagine debugging is much like it is in C. Wait for the breakpoint > to trip, then inspect the programme variables. That's a pretty crude form of debugging (although much better than just single stepping from the beginning!). Adding conditional

Re: Applying winpdb_reborn

2021-05-29 Thread Alan Gauld via Python-list
On 29/05/2021 19:10, Dennis Lee Bieber wrote: > On Sat, 29 May 2021 09:51:04 -0700 (PDT), Rich Shepard > declaimed the following: >> What I find interesting is that every web page I find on 'using pdb' does no >> more than explain the available commands; they don't explain the debugging >> proces

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Alan Gauld via Python-list
On 26/05/2021 22:15, Tim Chase wrote: > If you don't decode it upon reading it in, it should still be 100MB > because it's a stream of encoded bytes. I usually convert them to utf8. > You don't specify what you then do with this humongous string, Mainly I search for regex patterns which can

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Alan Gauld via Python-list
On 26/05/2021 14:09, Tim Chase wrote: >> If so, doesn't that introduce a pretty big storage overhead for >> large strings? > > Yes. Though such large strings tend to be more rare, largely because > they become unweildy for other reasons. I do have some scripts that work on large strings - mainl

string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Alan Gauld via Python-list
On 25/05/2021 23:23, Terry Reedy wrote: > In CPython's Flexible String Representation all characters in a string > are stored with the same number of bytes, depending on the largest > codepoint. I'm learning lots of new things in this thread! Does that mean that if I give Python a UTF8 string

Re: learning python ...

2021-05-25 Thread Alan Gauld via Python-list
On 25/05/2021 00:41, Jon Ribbens via Python-list wrote: > What would you call the argument to a function that > returns, say, an upper-cased version of its input? Probably 'candidate' or 'original' or 'initial' or somesuch. Or even just 's'. Single character names are OK when there is no signifi

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 19:48, Grant Edwards wrote: >> Traceback ( File "", line 1 >> if = 1.234 >>^ >> SyntaxError: invalid syntax > > I must admit it might be nice if the compiler told you _why_ the > syntax is invalid (e.g. "expected conditional expression while parsing > 'if' statement").

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 16:54, Michael F. Stemper wrote: > In my early days of writing python, I created lists named "list", > dictionaries named "dict", and strings named "str". I mostly know better > now, but sometimes still need to restrain my fingers. I think most newbie programmers make that mistake.

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 07:21, hw wrote: >> Inside the function f() the name 'x" shadows the global "x"; references >> to "x" are to the function's local vairable. Which is very desireable. > > If it works that way, I would consider it an entirely different > variable. Remember that in Python variables

Re: STARTUP FAILURE

2021-05-13 Thread Alan Gauld via Python-list
On 13/05/2021 14:49, Sumukh chakkirala wrote: > Hello, I have been facing this " startup failure" for a while now, I can > open the IDLE from the programs that I have saved but I'm not able to open > the IDLE directly. Hope you can help me with this issue as soon as possible. > Usual questions:

Re: Start Python programming

2021-04-28 Thread Alan Gauld via Python-list
On 27/04/2021 18:32, Gazoo wrote: > I'd like to start learning Python programming. What sites/tutorials > could you recommend for beginner, please. There is a getting started page on the python web site with links to guide you to many listed suggestions - books, web tutorials, video courses etc.

Re: "py.ini" question

2021-04-25 Thread Alan Gauld via Python-list
On 24/04/2021 15:23, Gisle Vanem wrote: > I have a question about the Python launcher; >c:\Windows\py.exe and the py.ini file. > > I have both Python 3.6 (32-bit) and Python 3.8 (64-bit) > installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini' > with this only: >[defaults] >pyth

Re: Ad-hoc SQL query builder for Python3?

2021-04-25 Thread Alan Gauld via Python-list
On 24/04/2021 15:24, Rich Shepard wrote: > My web searches are not finding what I need to include in an application I'm > building: an ad-hoc sql query builder. > > End users will want to query their data for reports not included in the > built-in queries. I assume you understand the huge risks i

Re: do ya still use python?

2021-04-20 Thread Alan Gauld via Python-list
On 20/04/2021 04:47, Dan Stromberg wrote: > Actually, this list is less busy than it was a decade or two ago, but > that's probably because of things like stackoverflow, python-dev, pypy-dev, > cython-devel, python-ideas, distutils-sig, issue trackers, code-quality, > and probably others. > > The

Re: Ann: New Python curses book

2021-04-15 Thread Alan Gauld via Python-list
On 14/04/2021 19:55, Rich Shepard wrote: > On Wed, 14 Apr 2021, Alan Gauld via Python-list wrote: > >> The paper version should be fine (apart from one error on p44 which has >> now been fixed!). > > Alan, > > What's the error and correction so I can change it

Re: port to PDOS (especially mainframe)

2021-04-14 Thread Alan Gauld via Python-list
On 14/04/2021 11:35, Paul Edwards wrote: > I have succeeded in producing a Python 3.3 executable ... > However, the executable doesn't work yet. Late to this party but how big is the assembler? It might be easier to translate the Python to C! I've done that in the past and with the aid of a few fun

Re: Ann: New Python curses book

2021-04-14 Thread Alan Gauld via Python-list
On 30/03/2021 12:12, Alan Gauld via Python-list wrote: > I've just published, in Kindle and paperback formats, I've just noticed that the kindle version has several indentation problems in the code listings. I can't do anything to fix it because it is all perfectly aligned

Re: UI design: combobox or radiobuttons?

2021-04-13 Thread Alan Gauld via Python-list
On 13/04/2021 22:53, Rich Shepard wrote: > While a set of radiobuttons occupies more room on the parent widget than > does a combobox are there any technical or user issues that would suggest > using one over the other? readability? If the combo box puts the units immediately beside the value the

Re: Ann: New Python curses book

2021-04-12 Thread Alan Gauld via Python-list
On 12/04/2021 00:53, Daniel Nelson wrote: >> (It should be available in most other Amazon stores too) > > This looks handy, I'd love to buy a copy but I don't do business with > Amazon if I can avoid it. Any chance this will be available from other > locations? I tried to publish it on several

Re: How to access a variable from one tab in another tab of a notebook?

2021-04-08 Thread Alan Gauld via Python-list
On 08/04/2021 06:01, Mohsen Owzar wrote: >> But this is why GUIs are often(usually?) built as a class >> because you can store all the state variables within >> the instance and access them from all the methods. >> >> You can do it with functions but you usually wind up >> with way too many gl

Re: How to access a variable from one tab in another tab of a notebook?

2021-04-07 Thread Alan Gauld via Python-list
On 07/04/2021 09:35, Mohsen Owzar wrote: > The problem is that I can't use the variable "val" from Tab2 in Tab 1, > # Filename: Tab1.py > from tkinter import * > > def gen_t1(frame): > f = LabelFrame(frame, text='f', bg='lightgreen') > f.pack(expand=True, fill='both') > > b1 = Button(f,

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread Alan Gauld via Python-list
On 02/04/2021 21:33, dn via Python-list wrote: > Bournville was the only Cadbury chocolate I would > consider. Today, even that seems to lack Cadbury has always been a budget chocolate brand(*) here; its a mass market option loaded with sugar and little else. Certainly doesn't compare to Suchards

Re: Friday Finking: initialising values and implied tuples

2021-04-02 Thread Alan Gauld via Python-list
On 02/04/2021 23:10, dn via Python-list wrote: > When there are several items to be defined and initialised, how do you > prefer to format the code, and why? > (a) basic linear presentation: > > resource = "Oil" > time = 1 > crude = 2 > residue = 3 > my_list = "long" In production code I'd almos

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread Alan Gauld via Python-list
On 02/04/2021 00:42, dn via Python-list wrote: > Contrarily "tuck" in (old) English slang represented "sweets" (or Not that old. We still use it occasionally today. And we certainly had a "tuck shop" at school. It was where you bought lunch if not eating in the refectory. ie. sandwiches, crisps,

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-01 Thread Alan Gauld via Python-list
On 01/04/2021 00:14, Chris Angelico wrote: > On a scale of 1 to "submit this to The Daily WTF immediately", how bad > is this code? :) The only worthwhile test of code quality is whether a new member of the team, competent in the language but not an expert can understand the code in two readings

Source code link was: Re: Ann: New Python curses book

2021-03-31 Thread Alan Gauld via Python-list
On 31/03/2021 00:09, Alan Gauld via Python-list wrote: > Watch this space. Hopefully tomorrow. The source code is now available in a zip file at: http://www.alan-g.me.uk/hills/PythonCursesCode.zip Or via a link on the programming section of my home page http://www.alan-g.me.uk/ It

Re: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 20:05, Brian Oney via Python-list wrote: > Congratulations! > > Indeed, I was wondering for a moment if this was a guide to al dente > spaghetti code. With each curse being a funny way to mess with the colleagues > performing the code review ;) You may jest but I originally titled

Re: Ann: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 19:52, Grant Edwards wrote: > It is. I just bought the kindle version on the US site, and it renders > fine in the cloud reader. It would be cool if you could cut/paste code > examples from the book into IDLE or a text editor, but I've never been > able to get the cloud reader to all

Re: memory consumption

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 16:50, Chris Angelico wrote: >> A 1GB process on modern computers is hardly a big problem? >> Most machines have 4G and many have 16G or even 32G >> nowadays. >> > > Desktop systems maybe, but if you rent yourself a worker box, it might > not have anything like that much. Especially

Re: Ann: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 17:14, Grant Edwards wrote: > Is the kindle format readable via a web browser pointed at > read.amazon.com (AKA "Kindle Cloud Reader)? It seems to be, I downloaded the free sample and could read the first 2 chapters on the web reader. -- Alan G Author of the Learn to Program web s

  1   2   >