r/Python • • Sep 10 '19

I started learning python about a month ago. Today I sat down and decided that I wanted to create tictactoe. And thats what I did. Felt so good when it all came together.

Post image
1.1k Upvotes

r/Python • • Feb 26 '26

Discussion Porn in Conda directory

1.1k Upvotes

Okay, I am flustered here. Today, at work, I attempted to open up YouTube from within the Microsoft search menu. To my shock and horror, the first suggested app was “Youporn.” I don’t watch porn on my work pc.

I looked at the file location and lo and behold, it’s a MS-DOS application file found within Anaconda3\pkgs\protego\info\test\tests\test_data

WTF?!

Anyone familiar with the Protego library? What is going on here? I can only imagine if my IT administrator or boss saw this pop up on my windows search.


r/Python • • Jun 24 '18

My nephew got his first Raspberry Pi today :)

Post image
1.1k Upvotes

r/Python • • Oct 17 '22

Tutorial PYTHON CHARTS: the Python data visualization site with more than 500 different charts with reproducible code and color tools

1.1k Upvotes

Link: https://python-charts.com/
Link (spanish version): https://python-charts.com/es/

This site provides tutorials divided into chart types and graphic libraries:

The graphs can be filtered based on the library or chart type:

Each post contains detailed instructions about how to create and customize each chart. All the examples provide reproducible code and can be copied with a single click:

The site also provides a color tool which allows copying the named, colors or its HEX reference:

There is also a quick search feature which allows looking for charts:

Hope you like it!


r/Python • • Jan 21 '20

Started learning Python a few months ago...today I finished my first game from scratch using Pygame!

1.1k Upvotes

r/Python • • Feb 01 '23

Resource I’m developing a programming game where you use Python to automate all kinds of machines, robots, drones and more and solve exciting bite-sized coding challenges.

1.1k Upvotes

Six weeks ago, I announced JOY OF PROGRAMMING here on r/python and it was met with an overwhelmingly positive reception and a lot of valuable feedback. In case you missed it, the game is all about practicing and applying your Python skills to challenging tasks in realistic, physically simulated 3D environments. It will cover a wide variety of topics, from basic algo / ds, oop, GUI programming to control theory, robotics, image processing, machine learning, genetic algorithms, and more. Of course it will also include a basic tutorial for beginners, but I plan to include interesting challenges for all skill levels. In my day job I’m a CS professor, and this game actually started out as a tool I used in-class for my students. For the last 19 months I’ve been developing this prototype into a proper game.

Speaking of development, in these last 6 weeks I added a lot of new features, polished and cleaned up many things, and improved the API documentation and made everything fully pep8 compliant. Also I finally got around to recording a longer gameplay trailer, which is hot off the press and I’d like to share it with you. Please head over to the game’s Steam page where you can check it out (it’s the second video there, though I recommend watching the first teaser if you haven’t already).

https://store.steampowered.com/app/2216770/JOY_OF_PROGRAMMING__Software_Engineering_Simulator

I’m very much looking forward to your feedback or your questions, and of course if you have a Steam account and you like what you see, consider a wishlist. This really helps to “feed” Steam’s recommender algorithm to spread the word about JOY OF PROGRAMMING and hopefully getting more people into Python programming that way!


r/Python • • Oct 07 '22

Intermediate Showcase Im making a video editor in Python. Yes, i'm crazy. No, it wont lag

1.1k Upvotes

NEW POST.

https://www.reddit.com/r/Python/comments/101hu89/i_am_still_making_a_video_editor_in_python_i_am/?utm_source=share&utm_medium=android_app&utm_name=androidcss&utm_term=1&utm_content=share_button

Motive

I am making a video editor in Python due to a lack of free editors who have the features i want them to have, without needing a super beefy computer to run, I'm talking: keyframes, 3d animations, etc.

This was a spontaneus decision by me because a malaysian friend was forced to use kinemaster because his pcs have no more than a core 2 duo.

Why wont i use something else?

Because python is really easy to just get stuff working without making a ton of bullsh** boilerplate just to move an image in 3d or paste and image on top of another.

The backstory

There is a genre of videos called "crazy errors" they were quite popular back in 2011-2014, they involve error messages popping up in rythm to music, making it look like a virus (the video itself was most commonly made in a video editor like premiere or vegas pro). It most commonly featured IOSYS's "Marisa Stole the Precious Thing", although other songs could appear too.

It was near the end of 2020, back then I found out that windows93.net has a crazy error program. The difference is, is that the errors that popup, are actually interactive and are real windows in the os. This blew my mind and i immediately needed to know how it worked.

Turns out, they used a MIDI for sequencing the errors! Each note did something, either open an error, clear the screen, show a bsod, etc. This blew my mind(Again!), because a midi is the perfect method for doing this. DAWs support it, and whats better for syncing events to audio than a piano roll in a DAW?

I used that method for my first crazy error, it opened real windows on your computer and was quite resource intensive.

Uploaded it to Youtube, gained 340 subs, 35k views, etc etc, May of 2021 comes in and i want to do something different. I want to do a 100 sub special, but this time, a different OS.

"A different OS? How? You would have to get a vm! And even then, it cant be older than Windows 7!"

But what if the errors were fake?

What if they were just images that appeared on the screen?

Thats what i did. I learned PIL, made the special, it was only one type of error, but it taught me a lot.

The program saved each frame to a png, and then i had to use ffmpeg to generate a mp4 out of them.

After that i made a 3D one, and it was fake Windows 7 errors, but animated. Had to make an entire window system for that one, each error was an element in a list, holding info about the current animation frame, position, images, etc.

After that i made a Windows XP crazy error, which had a better version of the window system and was filled to the brim with moving windows, spamming, and a gun!

Then, i made an entire error generator! Which is extremely accurate and will be part of the editor. It even works on py-script! relt-1.github.io/app/ play with it!

And that brings us to the present, where i had a vision, of a huge 10 minute medley, with all the songs and oses, a tribute to the genre. While i was making that, i got the idea for a crazy error maker, with the error generator built in. I thought to myself: "If im making a crazy error editor, i might just make the tribute in it! To showcase the power of the program!"

The how

Im using PIL for generating the frames. Pygame to display the playback. And tkinter for UI.

The timeline is rendered with PIL too!, a lot easier to manage an image than to use ui elements.

I use "Keyframes" for the error sequencing, currently theres only one keyframe type, but in the future, there will be a lot more of them, and even a 2d timeline!

Lets get real, Python is slow. But what isnt slow, is dictionary access. If i can convey all the opened errors before the cursor in a string, i could save that in a dict, and then access it later instead of computing the frame all over again.

Coding in Python is like coding a C128, you'll feel awesome, until you have to optimize.

And if you wont optimize, you might aswell not code either.

I optimized it HARD. 60 fps playback even on crappy pcs. Thats what i mean.

Not only that, but the program features:

  • WAV markers (USE THEM PLEASE THEY ARE IN FL STUDIO AND REAPER)

  • BPM snapping

  • Custom errors/images, you can already make some sh**posts with it!

  • Custom animations. Did i mention the program has superaccurate windows 7 animations with data taken directly from the code? 3d Position, Rotation, and Pivot point.

  • Aero blur.

  • Background image

  • Presets

  • Automatic inactive windows

I am adding more features every day, which brings me to the

Future of the project

I want this program to be a full on video editor. With video clips, text generator, special effects, and even some audio processing!

But before that, i have to complete the crazy error part. Things to do:

  • More oses

  • Balloons

  • UAC window

  • Compositing manager (will make caching a lot faster)

  • Closing windows (harder than it sounds actually)

  • Layers

  • Desktop generation

  • probably even more.

Videos

The project is in an early state. Everything is subject to change

WAV marker showcase https://media.discordapp.net/attachments/1022791896067735602/1025732640080408626/2022-10-01_13-34-26.mp4

early custom animation https://media.discordapp.net/attachments/1022791896067735602/1026538677532368936/pythonw_OpY2DRj1Wa.mp4

A small preview made in the program https://media.discordapp.net/attachments/742311461631819786/1027499039249403934/a.mp4

More videos coming soon!

I need your help!

I wouldnt call myself a pro at Python, thats why i need YOUR help! I doubt i'll finish this project just by myself. If you are interested and know anything about moviepy, kivy, pygame, pillow, etc. Please DM me on reddit or discord (Relt#4423), we can discuss.

Download?

Here is the current source code: https://github.com/relt-1/czeditor

TL DR

I made a video editor for crazy error videos, but now i want it to be larger in scope.


r/Python • • Sep 04 '21

News Python running without an OS!

Thumbnail
youtu.be
1.1k Upvotes

r/Python • • May 27 '21

Intermediate Showcase Used Python to build a r/wallstreetbets sentiment analyzing algo-trader (I used VADER sentiment analysis) -- 33% annual return ($16k). Source code, pictures, and results!

1.1k Upvotes

Source code

Hosted version (how to actually run/invest in it). Folks the amount of y’all that have messaged me asking for this is absolutely AMAZING but I can’t keep up! Posting the link here for you guys

HOW I DID THIS

Scraped WSB sentiment, got the top + most positively mentioned stocks on WSB (for the better part of this year, that's been $GME and $AMC, recently some $SPCE and $NVDA, and about 13 other stocks. I have the strategy rebalancing monthly. The source code is actually pretty intuitive, but essentially what it uses is VADER ( Valence Aware Dictionary for Sentiment Reasoning), which s a model used for text sentiment analysis that is sensitive to both polarity (positive/negative) and intensity (strength) of emotion.

The way it works is by relying on a dictionary that maps lexical (aka word-based) features to emotion intensities -- these are known as sentiment scores. The overall sentiment score of a comment/post is achieved by summing up the intensity of each word in the text.

In some ways, it's easy: words like ‘love’, ‘enjoy’, ‘happy’, ‘like’ all convey a positive sentiment. Also VADER is smart enough to understand the basic context of these words, such as “did not love” as a negative statement. It also understands the emphasis of capitalization and punctuation, such as “ENJOY” which is pretty cool. Phrases like “The acting was good , but the movie could have been better” have sentiments in both polarities, which makes this kind of analysis tricky -- essentially w VADER you would analyze which part of the sentiment here is more intense.

Results and some stats:

Right now I'm up 60% YTD, compared to the SP500's 13% (the recent spikes in GME and AMC have helped tremendously)

- The strategy is backtested only to the beginning of 2020, but I'm working on it. It's got an annualized return of 33% (compared to 16% for the SP500)

- Max drawdown of -8.7% (aka how far it went down before coming back up -- interestingly enough, WallStreetBets weathered COVID pretty well)

Happy to answer any more questions about the process/results. I think doing stuff like this is pretty cool as someone with a foot in algo trading and traditional financial markets


r/Python • • Dec 13 '20

Beginner Showcase From complete beginner to django website

1.1k Upvotes

6 months ago I’d never written a single line of code, in any language. I decided completely out of the blue to do a course on “coding for data analysis”, I very nearly picked one on human biology instead. It was just something to fill the lockdown boredom, but I quickly and unexpectedly started to enjoy it more and more.

Fast forward 3 months and I started learning html and then django. From that the idea to create www.rugbykickoff.com, which has just gone live now.

I honestly can’t believe how quickly it was to pick the language up with the amount of help available online.

I lost motivation several times getting completely lost at stack overflow answers where I didn’t understand a single concept etc. But this is testament to persevering and the massive amount of online support that’s available.

To anyone in the same boat, don’t give up!


r/Python • • Sep 24 '19

I took some suggestions and improved my solar system generator with better rings and colorful stars

Post image
1.1k Upvotes

r/Python • • Apr 21 '22

Discussion Unpopular opinion: Matplotlib is a bad library

1.1k Upvotes

I work with data using Python a lot. Sometimes, I need to do some visualizations. Sadly, matplotlib is the de-facto standard for visualization. The API of this library is a pain in the ass to work with. I know there are things like Seaborn which make the experience less shitty, but that's only a partial solution and isn't always easily available. Historically, it was built to imitate then-popular Matlab. But I don't like Matlab either and consider it's API and plotting capabilities very inferior to e.g. Wolfram Mathematica. Plus trying to port the already awkward Matlab API to Python made the whole thing double awkward, the whole library overall does not feel very Pythonic.

Please give a me better plotting libary that works seemlessly with Jupyter!


r/Python • • Jan 20 '21

Discussion I’m 36 and just starting to learn Python. Is it realistic to think I could get a job in this field by 40?

1.1k Upvotes

Hello Python peoples. I’m brand new to all this but I really enjoy it. I don’t know why I waited until this late in life to dig in. Is it too late? Can I actually become proficient within maybe 4 years or so? I make about 50k a year at my current job and can’t go much higher. I recently had a kid and want to earn more. I’d love to do so with programming somehow. Does this path make sense to pursue?


r/Python • • Jan 29 '20

I Made This I wrote a small library to enable flexible piping in Python, and finally happy with my live rendering setup in vim. Figured I'd make a small demo.

1.1k Upvotes

r/Python • • Apr 04 '20

I Made This I'm a non-native English speaker and when watching podcasts/movies very often I find myself googling definition of a word so I wrote a very simple command line tool in python to make the process a little bit quicker

1.1k Upvotes

r/Python • • May 26 '23

Discussion Realised Ive spent 10 hrs learning to automate a job that takes me 15 minutes a week

1.1k Upvotes

And Im only half way through.

worth_it = True

Yes Im a noob


r/Python • • Aug 07 '20

Editors / IDEs The interactive python mode in VSCode is amazing

Thumbnail
youtu.be
1.1k Upvotes

r/Python • • Nov 20 '21

Tutorial You can insert Emoji using `\N{NAME_OF_EMOJI}`

Post image
1.1k Upvotes

r/Python • • Apr 18 '19

Suitable tattoo

Post image
1.1k Upvotes

r/Python • • Feb 04 '19

Best Python Cheatsheet Ever!

Thumbnail
gto76.github.io
1.1k Upvotes

r/Python • • Jun 18 '19

Created a click bot after reading Automate boring stuff :)

1.1k Upvotes

r/Python • • Nov 30 '22

Beginner Showcase Making €6,147,455 Overnight in in-game currency using Computer Vision

1.1k Upvotes

A Python bot used to play the game 'City Island'

Gameplay:

Why?

I've been playing strategy + city building + simulation? games like TownsMen 6, Clash of the Clans, and SimCity for the last 10 years.

On trying out City Island 5 I found it mildly irritating that my collectables could not accumulate while I was outside the game. I might have had the best businesses, strategy, etc but I had to be in the game to ensure I collect the cash/keys/gold over time. For example, if my bakery makes €100 per minute I would only earn €100 after leaving the game and coming back 24 hours later.

This became especially tiresome while trying to accumulate €5,000,000 required to buy the island shown below. This would take me roughly two weeks of gameplay if I don't spend any money - it's not worth it.

This is a problem that can be solved using one of the greatest tools in my tool belt - programming.

I decided to create a Python bot used to play the game using computer vision and image processing techniques. The bot should be able to play the game without any human intervention.

---

Results after running overnight

I started the game with €316,415:

The following morning I had €6,463,870:

I made €6,147,455 overnight!

I then proceeded to buy the Island I wanted:

Source code & guide

A basic guide on how I achieved it - https://paulonteri.com/thoughts/play-game-with-computer-vision

Source code - https://github.com/paulonteri/play-game-with-computer-vision


r/Python • • Dec 14 '20

Resource willmcgugan/rich Rich is a Python library for rich text and beautiful formatting in the terminal.

Thumbnail
github.com
1.1k Upvotes

r/Python • • Apr 11 '20

I Made This I made a script to automatically log into my zoom meetings and record it.

1.1k Upvotes