Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread Terry Reedy

On 1/16/2021 9:17 PM, 2qdxy4rzwzuui...@potatochowder.com wrote:


A bare minimum skeleton might look something like this:

 with open(filename) as f:
 for line in f.readlines():
 handle_one_line(f)


f.readlines() reads the entire file into a list of lines (strings).  If 
you do not need that,

for line in f:
is sufficient for iterating thru the file line by line.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread 2QdxY4RzWzUUiLuE
On 2021-01-16 at 17:46:13 -0500,
DonK  wrote:

> On Sat, 16 Jan 2021 14:56:37 -0600, 2qdxy4rzwzuui...@potatochowder.com
> wrote:
> 
> >On 2021-01-16 at 15:42:44 -0500,
> >DonK  wrote:

> >> For example, I've found a need to parse text documents quite a number
> >> of times over the years. Basic/VB is great at doing that. How's
> >> Python?
> 
> >
> >Python can do that.  Can you expand on "parse" and "text documents"?
> 
> There's nothing that I have any particular need for at the moment but
> it is something that I've done a number of times over the years. I
> think it's a common need?? 

Indeed.  :-)  In my experience, "parse" and "text documents" often mean
different things to different people.

> I've used Pascal and BASIC\VB for string parsing and BASIC\VB is much
> better. VB has all the string handling functions that you need built
> in but, for example, Pascal has some but you have to create others to
> be useful. Since I'm just beginning with Python I have no knowledge or
> criticism of how Python does this but I'm sure that it can.
> 
> Since I've retired I've written parsers for my bank records, medical
> records and other personally useful things. I would categorize them as
> trivial but useful.  i.e utility means useful
> 
> When I was working, in the 1999-2001 range, I wrote a parser in VB
> that unscrambled corrupted "batch files" for credit card processing so
> that vendors didn't have to spend hours rebuilding them by hand. Some
> of those files had over 700 credit card transactions in them. That's
> one example.

Sounds like you're parsing files composed of lines of plain text where
each line represents some kind of record (as opposed to parsing a
document containing programming code as a precursor to generating an
executable, or looking through a word processing document for something
important).

A bare minimum skeleton might look something like this:

with open(filename) as f:
for line in f.readlines():
handle_one_line(f)

Python has a capable string type for handling text; see
.

Or look into the fileinput module for a convenient way to run through a
collection of files and/or standard input.

> I'm looking forward to learning some Python, mostly for fun, but I'm
> sure that it will also be useful.

Absolutely!  :-)

Happy Hacking!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread DonK
On Sat, 16 Jan 2021 14:56:37 -0600, 2qdxy4rzwzuui...@potatochowder.com
wrote:

>On 2021-01-16 at 15:42:44 -0500,
>DonK  wrote:
>
>> Yes, Windows. Iterating open windows with the Window's API is easy the
>> hard (very hard) part is sending keystrokes to those windows to Save
>> them. It's very tricky because the timing is critical. 
>> 
>> You have to use one of those "spy" utilities to get the name and
>> classid for the controls that you want to send a command to, then use
>> the Window's API functions SendMessage or PostMessage to send the
>> message directly to the control or just put it in the message que.
>>  
>> Like sending an "s" to the File menu to (S)ave. It's more complicated
>> than you would think and it doesn't work very well. It's like pushing
>> on a string. 
>
>Then don't do that?  ;-)
>
>I'm no Windows expert (nor even a user), but do those applications have
>a scripting interface?  (DDE?  OLE?  COM?  Do those letters ring a bell?
>The right bell?  Are those technologies current?)  What you're trying to
>do sounds like working *against* those applications rather than with
>them.

No! I've used the interfaces that you mentioned (OLE and COM in
particular) but that was for apps that I, or my colleagues, wrote (for
an employer) "to expose their guts" many years ago. I've found few
general use Windows apps that support any form of scripting. MS Office
apps, famously, support OLE. Or they used to. My copy of Office is
2007 so I don't know about the newer versions. I think most of those
technologies might have died a long time ago but I could be entirely
wrong. Does Python use those methods to control Excel, etc??

There was a Windows Usenet app, that I was interested in, around 10,
maybe 20 years ago that exposed a Pascal language like interface but
there was no documentation and no support. I believe it only lasted a
short time. I'm pretty sure that it's name started with a "D". It
doesn't matter.

I tried the method that I described above with the Forte Agent
newsreader back in the dial-up days because people in one of the
programming newsgroups wanted to be able to upload/dowanload
(unattended) in the middle of the night. It might have been possible
to get it to work reliably but I gave up on it.

>
>> For example, I've found a need to parse text documents quite a number
>> of times over the years. Basic/VB is great at doing that. How's
>> Python?

>
>Python can do that.  Can you expand on "parse" and "text documents"?

There's nothing that I have any particular need for at the moment but
it is something that I've done a number of times over the years. I
think it's a common need?? 

I've used Pascal and BASIC\VB for string parsing and BASIC\VB is much
better. VB has all the string handling functions that you need built
in but, for example, Pascal has some but you have to create others to
be useful. Since I'm just beginning with Python I have no knowledge or
criticism of how Python does this but I'm sure that it can.

Since I've retired I've written parsers for my bank records, medical
records and other personally useful things. I would categorize them as
trivial but useful.  i.e utility means useful

When I was working, in the 1999-2001 range, I wrote a parser in VB
that unscrambled corrupted "batch files" for credit card processing so
that vendors didn't have to spend hours rebuilding them by hand. Some
of those files had over 700 credit card transactions in them. That's
one example.

I'm looking forward to learning some Python, mostly for fun, but I'm
sure that it will also be useful.


Thank you

Don
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread DonK
On Tue, 12 Jan 2021 10:16:47 +0400, Abdur-Rahmaan Janhangeer
 wrote:

>Greetings,
>
>Web with Python is really easy to get started with, here
>is a simple endpoint with a framework called Flask
>
>from flask import Flask
>app = Flask(__name__)
>
>@app.route('/')
>def hello_world():
>   return 'Hello World’
>
>if __name__ == '__main__':
>   app.run()
>
>As for Tkinter, it's really annoying.
>PyQt5 and others are a lot better.
>PyQt5 follows the Cpp function namings
>
>Kind Regards,
>
>Abdur-Rahmaan Janhangeer

Someone else also suggested a web interface for i/o. If I get that far
it seems like it will be something I'll need to take a look at.

A lot of my early programming was command line BASIC apps running on
MSDOS. Even some pretty BIG stuff. So, going back to that after 40+
years seems a little weird. :-)

I looked at some Youtube videos about creating mobile apps with Java
but that just didn't do it for me. As far as I've seen there isn't
really a way to do the small "ad hoc" type of utilities on a
smartphone that you can do on a desktop machine.

Don't get me wrong, I love my smartphone.  

Thanks, 

Don
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread 2QdxY4RzWzUUiLuE
On 2021-01-16 at 15:42:44 -0500,
DonK  wrote:

> Yes, Windows. Iterating open windows with the Window's API is easy the
> hard (very hard) part is sending keystrokes to those windows to Save
> them. It's very tricky because the timing is critical. 
> 
> You have to use one of those "spy" utilities to get the name and
> classid for the controls that you want to send a command to, then use
> the Window's API functions SendMessage or PostMessage to send the
> message directly to the control or just put it in the message que.
>  
> Like sending an "s" to the File menu to (S)ave. It's more complicated
> than you would think and it doesn't work very well. It's like pushing
> on a string. 

Then don't do that?  ;-)

I'm no Windows expert (nor even a user), but do those applications have
a scripting interface?  (DDE?  OLE?  COM?  Do those letters ring a bell?
The right bell?  Are those technologies current?)  What you're trying to
do sounds like working *against* those applications rather than with
them.

> For example, I've found a need to parse text documents quite a number
> of times over the years. Basic/VB is great at doing that. How's
> Python?

Python can do that.  Can you expand on "parse" and "text documents"?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread DonK
On Mon, 11 Jan 2021 21:56:48 -0800, Paul Rubin
 wrote:

>DonK  writes:
>> My problem is that I don't understand how Python programs are
>> used. (i.e user input and output) Is Python mainly used for backends?
>> I've seen some Python gui frameworks like Tkinter, PyQt, etc
>
>I would say at least for me, the i/o to my python programs tends to be
>be either files or network sockets.  I've written some fairly complex
>tkinter apps in the past, but these days, desktop GUI's almost seem like
>a 1990s thing.  If you want an interactive program, either it's a mobile
>app (Python is not so great at that, though see kivy.org) or a web app
>(so the user interacts with it through a browser).
>
>> So, what do you folks use Python for?
>
>Pretty much everything unless a) it's someone else's application written
>in another language so I have to use the other language; b) I need raw
>performance (C, C++) or some other specialized feature; or c) I want to
>get more practice with some other language (quite a few).
>
>> if the titlebar contains certain strings
>
>Yeah this sounds like a Windows thing.  I don't have any idea what it
>takes to make those Windows calls in Python since I'm mostly a Un*x
>programmer.

Yes, Windows. Iterating open windows with the Window's API is easy the
hard (very hard) part is sending keystrokes to those windows to Save
them. It's very tricky because the timing is critical. 

You have to use one of those "spy" utilities to get the name and
classid for the controls that you want to send a command to, then use
the Window's API functions SendMessage or PostMessage to send the
message directly to the control or just put it in the message que.
 
Like sending an "s" to the File menu to (S)ave. It's more complicated
than you would think and it doesn't work very well. It's like pushing
on a string. 


>
>> I know that Python is a very popular language so I'm sorry if it
>> sounds like I'm being critical. I really don't know enough about it to
>> be critical.
>
>If you're familiar with Javascript or Visual Basic, my impression is
>that Python is at about the same level, but with a (for me) subjectively
>cleaner style.  It doesn't have a static type system or a lot of
>boilerplate, so it's easy to bang out small scripts; but the compiler
>doesn't supply much long range error checking, so you have to be pretty
>devoted to test automation if you're doing anything sizeable.  There is
>now a syntax for optional type annotations in Python, and a tool called
>mypy for checking types based on the annotations.  The Python compiler
>itself ignores the annotations.  I've been using them and like them.


Hi Paul,

I doubt that I'll be doing anything sizeable, mostly just a little
learning and entertainment with an occasional small utility once in a
while. But, who knows?

For example, I've found a need to parse text documents quite a number
of times over the years. Basic/VB is great at doing that. How's
Python?


Thanks,

Don
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread DonK
On Tue, 12 Jan 2021 09:26:18 +1100, Chris Angelico 
wrote:

>On Tue, Jan 12, 2021 at 7:41 AM DonK  wrote:
>> Hi, I'm thinking about learning Python but I'm 74 years old and will
>> very likely not ever have a programming job again. I used to program
>> in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
>> languages.
>
>BTW, from my experience, there's very very few languages so obscure
>that not one person on this list has heard of them :)
>
>For example, I've used REXX, which is an IBM language found on some of
>the mainframes and also on OS/2, and I'm not the only person here who
>has.
>
>ChrisA

Hi Chris,

The mainframe language that I mentioned was/is? called KwikBasic. I
don't remember if it was all one word or not. It's not to be confused
with Microsoft's QuickBasic.

KwikBasic ran on the Unix OS and was, hands down, the worst
programming experience I've ever had. It was a Y2k fix for the
reservation system of a large Fortune 500 real estate "timeshare"
company. I probably shouldn't say that their name was Trendswest.

The update had to be completed by the end of October 1998 because they
would start taking reservations for 2000 in Nov, 1998. They hired me
to manage the "reservation" part of their Y2k update in the Summer.
(YES! It was late.)

It turned out that KwikBasic was VERY much like the other versions of
basic that I had used. Including MSDOS's QuickBasic and PDS. The two
nutty things about it were that it had only 2 data types, if I
remember corectly they were called number and string.

The worst thing was that there was just one directory that contained
2,702 source files (I'll never forget that number) with names like
217h9436. There was no index to tell you what 217h9436 was, what it
did, what part of the business it pertained to . . . nothing. There
was also no notation in the files. You just had to open each one of
them, read their code to find out what they did.

Also, we had Windows computers on our desks with MS Office installed
but the nearest computer that could run Kwikbasic was their UNIX
mainframe in the main buildings about .25 to .50 miles away. We were
supposed to write code at our desk with Windows Notepad and then, on
Fridays,  the IT manager would take our code over to compile it and
would let us know of any error codes. They said they were going to buy
some expensive workstation for our office, that would run RedHat,
which they were told would then run Kwikbasic. IDunno!

It would have been impossible to do the job as the IT mgr (Mike W.)
envisioned it but I was able to write some simple MS Office code that
searched all the source code files, in just a minute or 2, for any
reference to "Date" functions. As I recall, there weren't that many.

Anyway, Mike W. was a fool that spent all day, every day, screaming
about, mostly, politics. I wound up quitting iafter less than 2 weeks.

Thanks for replying and sorry for the long message.

Don
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: conceptual problem (was: A beginning beginner's question about input, output and . . .

2021-01-14 Thread Greg Ewing

On 14/01/21 11:49 am, Cameron Simpson wrote:

The "pure" OOP approach, where method calls are used as messages to set
or fetch aspects of the object, is usually does with getter and setter
methods like:

 x = o.getX()
 o.setX(9)


People use get and set methods, not because it's somehow morally
wrong to expose attributes directly, but as a workaround for the
lack of a language feature.

In C++ and Java, different calling syntax is required for direct
access and access mediated by methods, so if you start out exposing
something directly and then change your mind, all the code using it
has to be changed. For this reason, people got into the habit of
wrapping everything in get and set methods from the beginning,
"just in case".

Python doesn't have this problem -- you can turn an attribute
into a property at any time, and nothing else needs to change.
So get and set methods are unnecessary and actively discouraged
in Python.

(C#, if I understand correctly, gets this sort of half-right.
You can turn an attribute into a property, and the calling *source*
doesn't change, but it all has to be recompiled -- which kind of
defeats the purpose.)

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-14 Thread Peter Pearson
On Wed, 13 Jan 2021 21:46:08 - (UTC), Grant Edwards wrote:
> On 2021-01-13, Peter Pearson  wrote:
[snip]
>> Browsergui is not widely popular (I don't think anybody but me has
>> mentioned it on this newsgroup), but it was written to be simple and
>> Pythonic, and has served me well.  Browsergui just uses your browser as
>> its user interface.  Grab it from
>>
>> https://github.com/speezepearson/browsergui
>
> I've been browsing through to documentation and examples, and I don't
> see any way to do any sort of modern flexible layout (e.g. nesting
> horizontal and vertical flexboxes) where you can control which
> elements grow/shrink when the window size changes.
>
> Is there a way to span columns/rows in a grid or control which columns
> grow/shrink?
>
> Have I missed something?

I doubt you've missed anything important, though I'm not sure because
I haven't done any of the things you mention.  Browsergui is minimalist.
If you've done the "python -m browsergui.examples" and don't see 
something like what you want, it's probably not there.

I like Browsergui for simple tools that require a little more
interaction than straight command-line utilities: exploring the effect
of various value-settings on some curve on a graph, or exploring the
ranges of values in a CSV file, or (most recently) rearranging the
order of image files in a list.

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Greg Ewing

On 14/01/21 11:09 am, Grant Edwards wrote:

Perhaps I need to recalibrate my adjectives, but with
256KB+ of flash and 32KB+ of RAM, I wouldn't call them "small"


It's small by today's standards, when you consider that
multiple GB of RAM is commonplace now in most "real" computers.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Greg Ewing

On 13/01/21 7:57 pm, Christian Gollwitzer wrote:

  What do you mean, "until" ?

https://medium.com/@yon.goldschmidt/running-python-in-the-linux-kernel-7cbcbd44503c 


He's using Micropython. That's cheating! :-)

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: FridayFinking - Was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Rich Shepard

On Thu, 14 Jan 2021, dn via Python-list wrote:


Concerning the definition of "old"
- when I'm having a 'good day', it's anyone several years my senior (and
above)
- when I'm creaking and groaning, it's anyone remotely my age, and older.


About 45 years ago a 25-year-older friend of mine offered a great philosophy
of life. "We can do nothing about growing older," she told me, "but we can
do everything about growing old."

How true.

Rich
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Grant Edwards
On 2021-01-13, Peter Pearson  wrote:
> On Mon, 11 Jan 2021 15:37:58 -0500, DonK  
> wrote:
> [snip]
>>
>> I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
>> look kinda like adding a family room onto a 1986 double wide mobile
>> home, 
>
> Agreed.
>
> Browsergui is not widely popular (I don't think anybody but me has
> mentioned it on this newsgroup), but it was written to be simple and
> Pythonic, and has served me well.  Browsergui just uses your browser as
> its user interface.  Grab it from
>
> https://github.com/speezepearson/browsergui

I've been browsing through to documentation and examples, and I don't
see any way to do any sort of modern flexible layout (e.g. nesting
horizontal and vertical flexboxes) where you can control which
elements grow/shrink when the window size changes.

Is there a way to span columns/rows in a grid or control which columns
grow/shrink?

Have I missed something?

--
Grant


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Grant Edwards
On 2021-01-13, Dennis Lee Bieber  wrote:
> On Tue, 12 Jan 2021 15:18:05 - (UTC), Grant Edwards
> declaimed the following:
>>On 2021-01-12, songbird  wrote:
>>
>>> it can be used for pretty much anything except perhaps high
>>> pressure real time things, but i bet someone else will know that
>>> is being done too, i've just not heard of it.  :)
>>
>>AFAIK, Python can't be used to write device drivers for any popular OS
>>(Linux, Unix, Windows, OSX). It also can't be used on small embedded
>>systems (real-time or not).
>
>   MicroPython/Circuit Python. Native language for AdaFruit's Metro
> boards.

Those are very cool, and I've come this -><- close to ordering one in
the past.  Perhaps I need to recalibrate my adjectives, but with
256KB+ of flash and 32KB+ of RAM, I wouldn't call them "small" -- even
though the Trinket M0 is physically tiny. But that may just be my age
showing. I remember not _that_ long ago working on processors where
the RAM was measured in hundreds of bytes. And I still maintain code
for ARM parts with way less than 1/10 the memory of the Trinket M0.

--
Grant



-- 
https://mail.python.org/mailman/listinfo/python-list


FridayFinking - Was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread dn via Python-list
On 14/01/2021 04.54, Grimble wrote:
> On 11/01/2021 20:37, DonK wrote:
>>
>> Hi, I'm thinking about learning Python but I'm 74 years old and will
>> very likely not ever have a programming job again. 

> At 83, I have no intention of having a programming job again! I last
> coded something professionally 45 years ago, but it hasn't lost its
> attraction.

Hey, some 'silver surfers' who have a few years on me!

Concerning the definition of "old"
- when I'm having a 'good day', it's anyone several years my senior (and
above)
- when I'm creaking and groaning, it's anyone remotely my age, and older.


Of course, many of my colleagues have fairly similar understandings -
for them anyone with the digit "3" (or greater) at the front of their
age, is not so much old (saying that would be rude!), but "ancient"!


That said, such young-bucks wrestling with cloud-concepts today, were
totally nonplussed when I told them how (mainframe) computer bureaux
used to work. The 'mechanics' may be different, but the management is
little-changed!


...

> I find this a fascinating news group - shame there's been no updates to
> Friday Finking recently!


With all due apologies!

I work(ed) with a particular team in a mentoring rôle, handling reviews,
walk-throughs, some design meetings, Python version-upgrades coaching,
etc. One of these was a 'morning tea' meeting, when we would
discuss/debate/argue 'Python best practice' topics, either raised by
members or that arose from other meetings but were best not discussed
there-and-then.

If there was an interesting topic, or one that 'we' hadn't really
settled satisfactorily within the group, I would try to re-frame the
discussion, and consult 'the oracles' here. So, that's the raison d'être
and motivation of the "Friday Finking" series..


Then along came COVID-19, and although this country's response was
amongst the best in the world, the team (and its routines) all-but
fell-apart. Firstly, we had to adjust to working remotely. The effort
that went into 'Friday Finking' was quickly absorbed into figuring-out
remote-techniques and maintaining the social component of the team's
success. Then a bunch of us were 'released to other duties' and
landed-in high-pressure projects to do with modelling pandemic
response-options. Various other interventions, life moved-on, etc, etc -
stories familiar to most, I'm sure.


So, thank you for the gentle reminder. Even though that team is still
not meeting as it once did, there's plenty of other 'inspiration', eg a
parallel discussion 'here' about the virtues of a programmer positioning
dialog(ue)s/windows or leaving it to the window manager...


I'll give it some thought - as long as Fridays keep coming!
-- 
Regards =dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: conceptual problem (was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Cameron Simpson
On 13Jan2021 10:37, songbird  wrote:
>  my momentary conceptual problem is that to me OOP means
>being able to encapsulate data structures and code from
>other parts of the program, but to me it doesn't look like
>that is how python is designed.  this is probably a complete
>aside to this whole thread and perhaps even this newsgroup
>so i'll subthread this.

Python allows you to avoid mucking with the object internals from 
outside. But it doesn't prevent it.

So you can (and often should) adopt an OOP approach - it reduces the 
dependencies between your classes, with the benefits that brings.

The "pure" OOP approach, where method calls are used as messages to set 
or fetch aspects of the object, is usually does with getter and setter 
methods like:

x = o.getX()
o.setX(9)

In Python this is less common. Simple things like that which do not 
intrude much on the conceptual model (i.e. if all such things will have 
an "X") are usually exposed as a public attribute which you can get or 
set directly:

x = o.x
o.x = 9

"Public" attributes in Python are just a convention: we name "private" 
attributes with a leading underscore and "public" attributes with 
leading letters and expect people using our classes to behave well.

Sometime we _don't_ have a plain old attribute "x", but we do have a 
property of the object looking like it. Then you can implement something 
which looks like an attribute from outside:

@property
def x(self):
# "x" if a derived value
return self._a + self._b

@x.setter
def x(self, new_x):
# setting "x" gets split between _a and _b
x2 = x / 3
self._a = x2# put some in _a
self._b = x - x2# put the rest in _b

# you can still do this, but it calls methods now
x = o.x
o.x = 9

So Python supports OOP practices but doesn't enforce them. Adopt the 
degree of discipline you think best.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Peter Pearson
On Mon, 11 Jan 2021 15:37:58 -0500, DonK  wrote:
[snip]
>
> I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
> look kinda like adding a family room onto a 1986 double wide mobile
> home, 

Agreed.

Browsergui is not widely popular (I don't think anybody but me has
mentioned it on this newsgroup), but it was written to be simple and
Pythonic, and has served me well.  Browsergui just uses your browser as
its user interface.  Grab it from

https://github.com/speezepearson/browsergui

then run "python -m browsergui.examples".

(Disclaimer/boast: I'm related to Browsergui's author.)

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread songbird
Christian Gollwitzer wrote:
> Am 13.01.21 um 06:24 schrieb Greg Ewing:
>> On 13/01/21 4:18 am, Grant Edwards wrote:
>> 
>>> AFAIK, Python can't be used to write device drivers for any popular OS
>> 
>> At least not until some crazy person embeds Python in the
>> Linux kernel...
>
>
>   What do you mean, "until" ?
>
> https://medium.com/@yon.goldschmidt/running-python-in-the-linux-kernel-7cbcbd44503c
>
> http://www.kplugs.org/

  yes!  haha!  :)  love it!  wish i had time to play now.


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Grimble

On 11/01/2021 20:37, DonK wrote:


Hi, I'm thinking about learning Python but I'm 74 years old and will
very likely not ever have a programming job again. 
At 83, I have no intention of having a programming job again! I last 
coded something professionally 45 years ago, but it hasn't lost its 
attraction.

So, what do you folks use Python for?

I have several scripts to help with activities for the charity that 
keeps me occupied. I've written a shopping list script with 
auto-completion and a couple of web-scraping applications that support a 
weather reporting application interfacing with various 1Wire sensors 
transcribed from an initial Ruby application. My largest GUI application 
is a database of personal contacts with input and output of data via 
vCards and .csv files (with a lot of mentoring from an American Gtk user!)
I find this a fascinating news group - shame there's been no updates to 
Friday Finking recently!


--
Grimble
Registered Linux User #450547
Machine 'Bach' running Plasma 5.15.4 on 5.7.19-desktop-3.mga7 kernel.
Mageia release 7 (Official) for x86_64


--
https://mail.python.org/mailman/listinfo/python-list


conceptual problem (was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread songbird
Chris Angelico wrote:
...projects that fade...
> That's not really something Python can ever control, but I can say
> with some confidence that the big libraries like Qt and GTK are going
> to adapt, one way or another. And perhaps more importantly: Neither
> input()/print() nor web applications is going *anywhere*. You are
> ALWAYS going to have those two as options.

  :)  i hope so. :)

  at the moment i've only done things with GTK and pyglet.
since i am way too new at python i can't say the code is
pretty, but it does work.

  my momentary conceptual problem is that to me OOP means
being able to encapsulate data structures and code from
other parts of the program, but to me it doesn't look like
that is how python is designed.  this is probably a complete
aside to this whole thread and perhaps even this newsgroup
so i'll subthread this.


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Grimble

On 11/01/2021 20:37, DonK wrote:




So, what do you folks use Python for?


I've written a shopping list script with auto-completion and a couple of 
web-scraping applications that support a weather reporting application 
interfacing with various 1Wire sensors transcribed from an initial Ruby 
application. My largest GUI application is a database of personal 
contacts with input and output of data via vCards and .csv files (with a 
lot of mentoring from an American Gtk user!)
I find this a fascinating news group - shame there's been no updates to 
Friday Finking recently


--
Grimble
Registered Linux User #450547
Machine 'Bach' running Plasma 5.15.4 on 5.7.19-desktop-3.mga7 kernel.
Mageia release 7 (Official) for x86_64
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Christian Gollwitzer

Am 13.01.21 um 06:24 schrieb Greg Ewing:

On 13/01/21 4:18 am, Grant Edwards wrote:


AFAIK, Python can't be used to write device drivers for any popular OS


At least not until some crazy person embeds Python in the
Linux kernel...



 What do you mean, "until" ?

https://medium.com/@yon.goldschmidt/running-python-in-the-linux-kernel-7cbcbd44503c

http://www.kplugs.org/

Christian
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Greg Ewing

On 13/01/21 4:18 am, Grant Edwards wrote:


AFAIK, Python can't be used to write device drivers for any popular OS


At least not until some crazy person embeds Python in the
Linux kernel...

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Grant Edwards
On 2021-01-12, Chris Angelico  wrote:

> * Command-line calculator - pressing Ctrl-Alt-P will open up a
>   terminal with Python, and that's the normal way that I do quick
>   calculations

I do that a lot too.

--
Grant





-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Cameron Simpson
On 12Jan2021 10:40, Michael F. Stemper  wrote:
>On 11/01/2021 14.37, DonK wrote:
>>I've installed Python 3.7, the PyCharm IDE and watched some Youtube
>>tutorials
>
>I would suggest that instead of watching tutorials, you open up your IDE
>and start writing stuff.

I would second that. Maybe this is a congnitive shortcoming on my part, 
but I find videos not useful for learning new programming. What they are 
great for is seeing explicit examples of something you are doing, 
particular if you hit some block and need to see someone _do_ what 
you're failing to do.

They're great for physical repair though, which again is an explicit 
example of a particular fixed task. Repaired our stand mixer with 
reference to a good video. Would not want to use a video to learn the 
theory of stand mixer design.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Cameron Simpson
On 12Jan2021 15:18, Grant Edwards  wrote:
>On 2021-01-12, songbird  wrote:
>>   it can be used for pretty much anything except perhaps
>> high pressure real time things, but i bet someone else will
>> know that is being done too, i've just not heard of it.  :)
>
>AFAIK, Python can't be used to write device drivers for any popular OS
>(Linux, Unix, Windows, OSX). It also can't be used on small embedded
>systems (real-time or not).

Well, yes and no. Not a pure device driver. But there are systems like 
FUSE for hooking kernel level filesystem stuff to an external system 
programme.  I've used the Python llfuse library to implement a 
filesystem in Python.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Chris Angelico
On Tue, Jan 12, 2021 at 7:41 AM DonK  wrote:
> So, what do you folks use Python for?
>

Since everyone else is, I'll add my list.

* API lookups of various sorts (usually via HTTP requests)
* Audio analysis. Calculate the maximum and average volume of each of
many songs.
* Code generation. The audio analysis output is in the form of a Lua
script (a VLC extension); also I have Python scripts that generate
SourcePawn code for CS:GO integration, and various other things.
* Decoding and analyzing myriad formats of files, including
Borderlands save files (now which character had that level 62
legendary weapon I wanted...)
* Mathematical analysis and testing. Python has excellent arithmetical
and higher mathematical tools.
* Automated tidying up of files to eliminate spurious diffs (eg with
OBS Studio's config files)
* Web apps involving PostgreSQL databases, various API calls, etc, etc
* Financial calculations - parse the downloaded transactions files
from my bank, correlate with my client list, automatically mark
invoices as paid
* Command-line calculator - pressing Ctrl-Alt-P will open up a
terminal with Python, and that's the normal way that I do quick
calculations
* And a ton of quick one-off scripts for a wide variety of jobs.

Python's one of my favourite languages, and I use it a lot :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Grant Edwards
On 2021-01-12, Chris Angelico  wrote:
> On Wed, Jan 13, 2021 at 3:18 AM Grant Edwards  
> wrote:
>>
>> On 2021-01-12, songbird  wrote:
>>
>> >   it can be used for pretty much anything except perhaps
>> > high pressure real time things, but i bet someone else will
>> > know that is being done too, i've just not heard of it.  :)
>>
>> AFAIK, Python can't be used to write device drivers for any popular OS
>> (Linux, Unix, Windows, OSX). It also can't be used on small embedded
>> systems (real-time or not).
>
> Depends how small.

Of course.

> An RPi has a full Linux system and can easily run Python scripts;
> and the pyboard runs a dedicated Python interpreter called
> MicroPython, broadly compatible with CPython 3.5, I think (some 3.x
> version, anyhow), albeit with a cut-down standard library. The
> pyboard is pretty tiny; according to the micropython.org blurb, it
> has 192KB RAM.

Yes, that's tiny compared to the desktop machine I'm posting from, but
I work with ARM parts (that are in active production production and
not EOL) with 2KB of RAM and 8KB of flash.

--
Grant



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Michael F. Stemper

On 12/01/2021 10.40, Michael F. Stemper wrote:


Modeling of electric power systems:
- load behavior in response to conservation load reduction


Sorry, that should have been "conservation voltage reduction".


--
Michael F. Stemper
Psalm 82:1-4
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread MRAB

On 2021-01-11 20:37, DonK wrote:



[snip]


So, what do you folks use Python for?


Since we're sharing:

- Personal information manager in the form of a tree of pages. Each page 
can have code associated with it which defines functions to call when 
shortcut keys are pressed, giving page-specific shortcuts for 
page-specific functionality.


- Simple money manager.

Both use tkinter.
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Michael F. Stemper

On 11/01/2021 14.37, DonK wrote:


I've installed Python 3.7, the PyCharm IDE and watched some Youtube
tutorials


I would suggest that instead of watching tutorials, you open up your IDE
and start writing stuff. Get an introductory python book (I used the
O'Reilly _Introducing Python_), start at the beginning, and type in each
example. Then, tweak it to see what happens.


I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
look kinda like adding a family room onto a 1986 double wide mobile
home, and they look even more complicated than creating a GUI from
scratch in C++ with a message loop, raising events . . .


I haven't really got my head around GUI programming myself. I tried to
write one with tkinter based on on-line examples, but didn't have any
conceptual framekwork, so it didn't work too well. I saw in a post here
that there are actually books on it, so I might pick one up and try
again.


So, what do you folks use Python for?


Since you asked:

Various command-line utilities, including:
- comparing the contents of two directories
- ad-hoc linear regression
- validation of DTDs
- sanity check of nesting symbols in TeX files
- ad-hoc plotting

Maintaining and querying of data bases:
- five-minute values of local temperatures
- Action items for an organization of which I'm secretary
- my own to-do list
- non-isomorphic groups that have isomorphic character tables

Modeling of electric power systems:
- load behavior in response to conservation load reduction
- generator and governor response to system load
- economic dispatch of generators, including those with non-monotonic 
incremental cost curves

(last two are very much works in progress)

Mathematics:
- experiments with number theory and combinatorics
- composition of permutations of a set
- properties of minimal paths through a C_m x C_n lattice
- generating tikz commands for geometric diagrams in TeX documents
- unstructured and uneducated exploration of Conway's Game of Life

--
Michael F. Stemper
2 Chronicles 19:7
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Chris Angelico
On Wed, Jan 13, 2021 at 3:18 AM Grant Edwards  wrote:
>
> On 2021-01-12, songbird  wrote:
>
> >   it can be used for pretty much anything except perhaps
> > high pressure real time things, but i bet someone else will
> > know that is being done too, i've just not heard of it.  :)
>
> AFAIK, Python can't be used to write device drivers for any popular OS
> (Linux, Unix, Windows, OSX). It also can't be used on small embedded
> systems (real-time or not).
>

Depends how small. An RPi has a full Linux system and can easily run
Python scripts; and the pyboard runs a dedicated Python interpreter
called MicroPython, broadly compatible with CPython 3.5, I think (some
3.x version, anyhow), albeit with a cut-down standard library. The
pyboard is pretty tiny; according to the micropython.org blurb, it has
192KB RAM.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Grant Edwards
On 2021-01-12, songbird  wrote:

>   it can be used for pretty much anything except perhaps
> high pressure real time things, but i bet someone else will
> know that is being done too, i've just not heard of it.  :)

AFAIK, Python can't be used to write device drivers for any popular OS
(Linux, Unix, Windows, OSX). It also can't be used on small embedded
systems (real-time or not).

--
Grant



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Grant Edwards
On 2021-01-11, DonK  wrote:

> So, what do you folks use Python for?

I mainly use it for writing command-line utilities. Many of them work
on either Windows or Linux, but are mostly used on Linux:

 * Two-pass symbolic assembler and dissassembler for a proprietary
   communications controller.

 * Utilties to encrypt/decrypt files in proprietary formats.

 * Protocol dissector that prints the contents of network traffic for
   a couple different proprietary protocols.  It will parse a file
   saved with Wireshark/tcpdump or it will display live traffic using
   libpcap.

 * A utility to discover and manage a couple different families of
   industrial products (discovery, configiration) using a proprietary
   UDP protocol.

 * Utilities to program firmware into various products and
   microprocessors.

 * Utilities to perform various operations (e.g. run-length encoding)
   on things like FPGA bitstream files.

 * Utilities that implement various serial protocols for testing
   devices that use those protocols.

 * Scraping my favorite comic strips from various web sites and
   compiling them into a local web page.

 * Utilties for working with industrial control devices using
   DeviceNet on CAN bus.

 * An email gateway daemon that accepted SMTP mail and relayed it to MS
   Exchange using WebDAV.

 * An email gateway daemon that fetched email from MS Exchnage using
   Outlook/DCOM and relayed to an SMTP server.

 * Custom SMTP servers used to test SMTP clients.
 

I also wire the occasional GUI application:

 * A GTK "terminal" application that connects to a serial port.

 * A GTK IMAP mailbox notification app that monitors any number of
   IMAP mailboxes and notifies the user when there is new mail.

 * WxWindows and Tk applications to do various device management tasks
   for industrial equipment (update firmware, change configurations,
   etc.) via TCP and UDP network protocols.

 * WxWindows utilities for working with industrial control devices
   using DeviceNet on CAN bus.

I've also written web "backend" code that gathers and archives data
from my solar panels every 10 minutes and then produces graphs and
charts on demand for AJAX web applications.

Where I work we also use Python to run our production stations --
testing and programming circuit boards and assembled products.

There are also a couple commercial applicatoins I use daily (but
didn't write) that are written in Python:

 Hiri (email client)
 Plex (DVR and home theater application)


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Chris Angelico
On Tue, Jan 12, 2021 at 5:26 PM songbird  wrote:
>   for python i just spend too much time fumbling around
> and i don't really know what is current and if i'm using
> something that will be kept up for the future or if the
> project is going away or in a direction that i won't like
> (both KDE and Gnome desktops messed me up with what they
> did after i spent a lot of time finding them, getting
> them set up and then they changed and i switched only to
> have the other do the same to me so i switched again to
> Mate and that at least has been more stable to my style of
> doing things).

That's not really something Python can ever control, but I can say
with some confidence that the big libraries like Qt and GTK are going
to adapt, one way or another. And perhaps more importantly: Neither
input()/print() nor web applications is going *anywhere*. You are
ALWAYS going to have those two as options.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread songbird
DonK wrote:
>
> Hi, I'm thinking about learning Python but I'm 74 years old and will
> very likely not ever have a programming job again. I used to program
> in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
> languages. It's been about 18-19 years since my last programming job.
> I do understand programming concepts but I'm really not up on any of
> the more modern programming languages.

  hi Don,

  you sound like you have a similar perspective to my own
except i'm a bit younger.  :)


> I've installed Python 3.7, the PyCharm IDE and watched some Youtube
> tutorials but it's been stretched out over about 1.5 years so I'll
> probably need to go back to the beginning. My problem is that I don't
> understand how Python programs are used. (i.e user input and output)
> Is Python mainly used for backends?

  it can be used for pretty much anything except perhaps
high pressure real time things, but i bet someone else will
know that is being done too, i've just not heard of it.  :)


> I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
> look kinda like adding a family room onto a 1986 double wide mobile
> home, and they look even more complicated than creating a GUI from
> scratch in C++ with a message loop, raising events . . .

  i tried pyglet just because it was the first one that i
could figure out without it being too complicated.


> So, what do you folks use Python for?

  for me i used it to learn python and wrote a simple game
which adapted an already existing game written in C to python.
since i don't really understand python and have issues with
some concepts it hasn't gone much further lately and i'm
ok with that.


> Nowdays I mainly just use programming for rather small utilities for
> my personal use. Currently I'd like to write something to iterate
> through open windows and save them to different folders depending on
> if the titlebar contains certain strings. In the past I would probably
> have used Excel's VBA to do this but I no longer have Excel installed
> on my main computer. I'd like a bit of a challenge but I don't want to
> spin my wheels trying to learn something that will be a dead end for
> me.

  i am so familiar with Bash shell script language and C 
that either of those would normally be my first choice
because i already have tools done for enough things and
i know what i'm doing.

  for python i just spend too much time fumbling around
and i don't really know what is current and if i'm using
something that will be kept up for the future or if the
project is going away or in a direction that i won't like
(both KDE and Gnome desktops messed me up with what they
did after i spent a lot of time finding them, getting
them set up and then they changed and i switched only to
have the other do the same to me so i switched again to
Mate and that at least has been more stable to my style of
doing things).

  uh, so, i think i do understand your aims and perspective
and hope you can get further in your goals.  :)


> I know that this probably seems like a stupid post but your input will
> be useful.
>
> Thank you.
>
>Don
>
> I know that Python is a very popular language so I'm sorry if it
> sounds like I'm being critical. I really don't know enough about it to
> be critical.

  heh, well, if you go back and read some of my previous posts
here you'd see a lot of dumb things i've said too.  don't worry.
i'm sure i'll make other dumb posts too, but at the moment i'm
mostly in a holding pattern for a while.  i have a few other
big projects i need to finish before i get back to python again.


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Abdur-Rahmaan Janhangeer
Greetings,

Web with Python is really easy to get started with, here
is a simple endpoint with a framework called Flask

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
   return 'Hello World’

if __name__ == '__main__':
   app.run()

As for Tkinter, it's really annoying.
PyQt5 and others are a lot better.
PyQt5 follows the Cpp function namings

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

github 
Mauritius


On Tue, Jan 12, 2021 at 12:43 AM DonK  wrote:

>
> Hi, I'm thinking about learning Python but I'm 74 years old and will
> very likely not ever have a programming job again. I used to program
> in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
> languages. It's been about 18-19 years since my last programming job.
> I do understand programming concepts but I'm really not up on any of
> the more modern programming languages.
>
> I've installed Python 3.7, the PyCharm IDE and watched some Youtube
> tutorials but it's been stretched out over about 1.5 years so I'll
> probably need to go back to the beginning. My problem is that I don't
> understand how Python programs are used. (i.e user input and output)
> Is Python mainly used for backends?
>
> I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
> look kinda like adding a family room onto a 1986 double wide mobile
> home, and they look even more complicated than creating a GUI from
> scratch in C++ with a message loop, raising events . . .
>
> So, what do you folks use Python for?
>
> Nowdays I mainly just use programming for rather small utilities for
> my personal use. Currently I'd like to write something to iterate
> through open windows and save them to different folders depending on
> if the titlebar contains certain strings. In the past I would probably
> have used Excel's VBA to do this but I no longer have Excel installed
> on my main computer. I'd like a bit of a challenge but I don't want to
> spin my wheels trying to learn something that will be a dead end for
> me.
>
> I know that this probably seems like a stupid post but your input will
> be useful.
>
> Thank you.
>
>Don
>
> I know that Python is a very popular language so I'm sorry if it
> sounds like I'm being critical. I really don't know enough about it to
> be critical.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Chris Angelico
On Tue, Jan 12, 2021 at 3:16 PM Greg Ewing  wrote:
> > Currently I'd like to write something to iterate
> > through open windows and save them to different folders depending on
> > if the titlebar contains certain strings.
>
> That sounds like it should be doable if you can get access to the
> right Windows API functions. Check out the pywin32 package. If that
> doesn't provide what you need, there's always ctypes (part of the
> standard python distribution, gives low-level access to C library
> functions).
>

Sounds like an awful lot of work. On Linux, I'd just subprocess out to
wmctrl and parse its output - way easier.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Greg Ewing

On 12/01/21 9:37 am, DonK wrote:


I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
look kinda like adding a family room onto a 1986 double wide mobile
home, and they look even more complicated than creating a GUI from
scratch in C++ with a message loop, raising events . . .


I'm surprised you find any of those toolkits more complicated
to use than the raw Windows API, which last time I dabbled in it
seemed fairly horrendous.

Unfortunately there doesn't seem to be a really good way to
easily make GUIs in Python. I tried to fill that gap a few years
back with PyGUI:

https://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/

You might like to check that out, but be warned that a few bits
of it are broken at the moment. It's badly in need of an overhaul,
and I don't have time to devote to it right now.


So, what do you folks use Python for?


Personal uses I can think of in recent times:

* Command line tools for various small tasks, often parts of
build systems for other projects.

* Games, using pygame, pyopengl, numpy and various other libraries.


Currently I'd like to write something to iterate
through open windows and save them to different folders depending on
if the titlebar contains certain strings.


That sounds like it should be doable if you can get access to the
right Windows API functions. Check out the pywin32 package. If that
doesn't provide what you need, there's always ctypes (part of the
standard python distribution, gives low-level access to C library
functions).

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Cameron Simpson
On 11Jan2021 15:52, Dan Stromberg  wrote:
>On Mon, Jan 11, 2021 at 2:22 PM Cameron Simpson  wrote:
>> >I've seen some Python gui frameworks like Tkinter, PyQt, etc. but 
>> >they
>> >look kinda like adding a family room onto a 1986 double wide mobile
>> >home, and they look even more complicated than creating a GUI from
>> >scratch in C++ with a message loop, raising events . . .
>>
>> They aren't really. I've not use Tkinter, but I have used PyQt.
>
>Maybe compared to Java or C# they are, which come with almost the only GUI
>toolkit that gets used.  But there's also a version of Qt for Java.  Not
>sure about C#.

Hmm, in the distant past I did write a small GUI app using Java. It was 
a little simpler than (current) Qt to my (fuzzy) recollection, but that 
might be partly because the toolkit itself was smaller. Unsure now.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Dan Stromberg
On Mon, Jan 11, 2021 at 2:22 PM Cameron Simpson  wrote:

> >I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
> >look kinda like adding a family room onto a 1986 double wide mobile
> >home, and they look even more complicated than creating a GUI from
> >scratch in C++ with a message loop, raising events . . .
>
> They aren't really. I've not use Tkinter, but I have used PyQt.
>

Maybe compared to Java or C# they are, which come with almost the only GUI
toolkit that gets used.  But there's also a version of Qt for Java.  Not
sure about C#.

I've mostly used GTK for GUI's and a little Tkinter for turtle graphics,
both in Python.  Both felt natural.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Chris Angelico
On Tue, Jan 12, 2021 at 7:41 AM DonK  wrote:
> Hi, I'm thinking about learning Python but I'm 74 years old and will
> very likely not ever have a programming job again. I used to program
> in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
> languages.

BTW, from my experience, there's very very few languages so obscure
that not one person on this list has heard of them :)

For example, I've used REXX, which is an IBM language found on some of
the mainframes and also on OS/2, and I'm not the only person here who
has.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Cameron Simpson
On 11Jan2021 15:37, DonK  wrote:
>Hi, I'm thinking about learning Python but I'm 74 years old and will
>very likely not ever have a programming job again. I used to program
>in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
>languages.

Therefore you're happy with classes, and are presumably with a Windows 
background. (And, of course, the mainframe world.)

>I've installed Python 3.7, the PyCharm IDE and watched some Youtube
>tutorials but it's been stretched out over about 1.5 years so I'll
>probably need to go back to the beginning. My problem is that I don't
>understand how Python programs are used. (i.e user input and output)
>Is Python mainly used for backends?

My personal Python use is almost all backend, and on a personal basis I 
spend most of my time at a command prompt in a terminal window.

However, you can write fully fledged GUI applications in Python.

Without a GUI Python programmes tend to work off their input and write 
to their output (or other files) like any other command line programme.

Chris mentioned input() for reading input and print() for writing 
output. input() is an interactive function (it accepts a prompt string 
and reads a single line of text). If you're writing something batchy, 
which might be in a pipeline or reading from a text file, then the 
standard input is sys.stdin and can be read in various ways - when that 
is text the typical way is just to iterate over it in a for-loop, which 
gets your lines of text.

Trite example:

import sys


lineno = 0
for line in sys.stdin:
lineno += 1
print("line number", lineno, "text =", line)

>I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
>look kinda like adding a family room onto a 1986 double wide mobile
>home, and they look even more complicated than creating a GUI from
>scratch in C++ with a message loop, raising events . . .

They aren't really. I've not use Tkinter, but I have used PyQt. You 
still have the usual framework:

- contruct widgets (windows and other GUI elements) with the associated 
  code which runs when you interact with them

- an event loop (usually simply entered after constructing the main GUI 
  component(s)) - it will run until told to stop

- raising events - in PyQt these are called "signals" - you issue a 
  signel/event with whatever information it uses and the event loop runs 
  its handler in due course

Part of the difficulty with PyQt (for me) is that it is a Python shim 
onto a quite large C++ widget library. Most of the actual doco seems to 
be the C++ side, and you need to infer some stuff to use it from Python.  
The shim is very one-to-one, so that works pretty well.

I gather that Tkinter is easier to get off the ground with.

>So, what do you folks use Python for?

Personally, almost entirely command line stuff, and making 
libraries/modules/packages which implement what I need.

>Nowdays I mainly just use programming for rather small utilities for
>my personal use.

Me too.

>Currently I'd like to write something to iterate
>through open windows and save them to different folders depending on
>if the titlebar contains certain strings. In the past I would probably
>have used Excel's VBA to do this but I no longer have Excel installed
>on my main computer. I'd like a bit of a challenge but I don't want to
>spin my wheels trying to learn something that will be a dead end for
>me.

This requires Windows specific knowledge, which I lack. Saving to 
folders etc is standard stuff, but the "iterate through open windows" 
and consulting their titlebar strings is platform, and maybe app, 
specific. I'm not a Windows person, alas.

>I know that this probably seems like a stupid post but your input will
>be useful.

No, it's entirely reasonable. Getting off the ground with a 
useful-to-you task is always the first hurdle with a new language.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread dn via Python-list
On 12/01/2021 09.37, DonK wrote:
> 
> Hi, I'm thinking about learning Python but I'm 74 years old and will
> very likely not ever have a programming job again. I used to program
> in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
> languages. It's been about 18-19 years since my last programming job.
> I do understand programming concepts but I'm really not up on any of
> the more modern programming languages.
> 
> I've installed Python 3.7, the PyCharm IDE and watched some Youtube
> tutorials but it's been stretched out over about 1.5 years so I'll
> probably need to go back to the beginning. My problem is that I don't
> understand how Python programs are used. (i.e user input and output)
> Is Python mainly used for backends?
> 
> I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
> look kinda like adding a family room onto a 1986 double wide mobile
> home, and they look even more complicated than creating a GUI from
> scratch in C++ with a message loop, raising events . . .
> 
> So, what do you folks use Python for?
> 
> Nowdays I mainly just use programming for rather small utilities for
> my personal use. Currently I'd like to write something to iterate
> through open windows and save them to different folders depending on
> if the titlebar contains certain strings. In the past I would probably
> have used Excel's VBA to do this but I no longer have Excel installed
> on my main computer. I'd like a bit of a challenge but I don't want to
> spin my wheels trying to learn something that will be a dead end for
> me.


Your question is very broad. Python is used for an incredibly wide
variety of purposes.

Frankly, why worry about my uses for Python, the only important stuff is
what you want to do with it!

There are plenty of articles 'out there' which discuss using Excel
[data] with Python, why one should prefer Python to Excel, etc. Try:
https://info.cambridgespark.com/latest/python-vs-excel (BTW with Python
and appropriate libraries, the Excel package itself is not required)

One way to learn is to ask the question: how do I do xyz in Python? You
have some background, so will be able to ask reasonably 'educated' and
valid questions. This will feel faster, but is by definition a
piece-meal approach.

Us 'silver surfers' often prefer a more structured (and complete)
approach, and preferably one which looks at the semantics of the
language (in Python we talk of idioms and the "Zen of Python") not
merely the syntax. Thus, I recommend (free or $) MOOCs on the edX or
Coursera platforms (amongst others).

As you say, the profession has 'moved on' and there are fresh approaches
and new angles to get one's head around... So, it's not just "Python" then!

PS you will likely find the Python-Tutor mailing list solid assistance.
-- 
Regards =dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Chris Angelico
On Tue, Jan 12, 2021 at 7:41 AM DonK  wrote:
>
>
> Hi, I'm thinking about learning Python but I'm 74 years old and will
> very likely not ever have a programming job again. I used to program
> in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
> languages. It's been about 18-19 years since my last programming job.
> I do understand programming concepts but I'm really not up on any of
> the more modern programming languages.
>
> I've installed Python 3.7, the PyCharm IDE and watched some Youtube
> tutorials but it's been stretched out over about 1.5 years so I'll
> probably need to go back to the beginning. My problem is that I don't
> understand how Python programs are used. (i.e user input and output)
> Is Python mainly used for backends?
>

Python is used in many different ways. I'd recommend focusing first on
the simple console input and output, which are available as the
input() and print() built-in functions; those are sufficient for a
vast majority of situations. Beyond that, you run into what's best
described as "inherent complexity"; building a good user interface is,
by its nature, not simple.

If it's easier, you can look into using a web browser as your user
interface. Python is superb at building web servers and web
applications, so you can easily design your app so the user interacts
with it using a very simple browser-based front end - either with
JavaScript or as a really easy form fill-out.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


A beginning beginner's question about input, output and . . .

2021-01-11 Thread DonK


Hi, I'm thinking about learning Python but I'm 74 years old and will
very likely not ever have a programming job again. I used to program
in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
languages. It's been about 18-19 years since my last programming job.
I do understand programming concepts but I'm really not up on any of
the more modern programming languages.

I've installed Python 3.7, the PyCharm IDE and watched some Youtube
tutorials but it's been stretched out over about 1.5 years so I'll
probably need to go back to the beginning. My problem is that I don't
understand how Python programs are used. (i.e user input and output)
Is Python mainly used for backends?

I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
look kinda like adding a family room onto a 1986 double wide mobile
home, and they look even more complicated than creating a GUI from
scratch in C++ with a message loop, raising events . . .

So, what do you folks use Python for?

Nowdays I mainly just use programming for rather small utilities for
my personal use. Currently I'd like to write something to iterate
through open windows and save them to different folders depending on
if the titlebar contains certain strings. In the past I would probably
have used Excel's VBA to do this but I no longer have Excel installed
on my main computer. I'd like a bit of a challenge but I don't want to
spin my wheels trying to learn something that will be a dead end for
me.

I know that this probably seems like a stupid post but your input will
be useful.

Thank you.

   Don

I know that Python is a very popular language so I'm sorry if it
sounds like I'm being critical. I really don't know enough about it to
be critical.
-- 
https://mail.python.org/mailman/listinfo/python-list