Multiclipboard -- clipboard persistence

Does anyone else have Al Sweigart’s Automate the Boring Stuff with Python? I’m not a huge fan of the fragmented style, in comparison to Zed’s, but it’s a useful book. The “multiclipboard” project from chapter 8 especially stood out to me for its utility – how many times do you need an old piece of text from the clipboard that’s been overwritten? Too many, darn it.

I’m not a huge fan of the manual argument parsing, so I went ahead and created a new version that uses argparse. You can find my repo

Also, I’m fairly new to Github, so any advice would be appreciated. I’ve got the basic “init-edit-add-commit-push” workflow down, but beyond that? Ehh…

Also, feedback on the code itself is obviously welcome. As my commits will show, I’ve been pushing myself to make it as robust and user-friendly as possible.

I’m considering removing some of the return codes – like in add() – because they seemed necessary at first, but that doesn’t seem the case now.

Looks good from what I’m seeing. The only thing is the use of a .pyw extension. Is that so it works with windows on a double-click?

As stated in the book,

The pyw extension means that Python won’t show a Terminal window when it runs this program.

Honestly, I have no idea about it making it work on Windows on double-click – I’m so used to doing everything in the CLI that I just run it with python3 mcb.pyw :joy:

Do you suggest changing it to a regular .py file? I kept it as .pyw because I didn’t really give it any thought.

Ahhh, that’s right. I don’t do much windows coding with Python so only vaguely remembered that hack. I would say that if it doesn’t do any windowing or graphics then python code should use .py, but it’s doing graphics and needs to pretend to be a desktop app then .pyw.

Eh, that makes sense. It is just a text-based program. Thanks for the input :slight_smile:

A free service run by Zed A. Shaw for learncodethehardway.org.