r/Python • u/anuj-99 • May 26 '20
r/Python • u/--CreativeUsername • Jul 27 '19
Simulating Quantum Mechanics Using Matplotlib and Tkinter
r/Python • u/The_Regent • Oct 06 '19
Playing Flappy Bird with Mixed Integer Programming
r/Python • u/SensibleJames • Nov 19 '19
I brute forced hello world [Code and Reasons in the comments]
r/Python • u/happymoe • Jan 07 '21
Discussion Today is my first day learning coding and I am awestruck.
Okay, so I'm a freshman in uni who was just vibing at home during winter break in quarantine with absolutely nothing to do. I'm scrolling on Youtube and I come across this 4 hour long video from freeCodeCamp.org about Python, and on a whim, I decide to just see what the computer science hype is all about. And-
BRO
BRO
I don't know what I expected coding to be, but this is fricking awesome. It just makes me baffled how I can just make stuff on my computer that has never existed in the history of the computer!
Like, I just learned about inputs, and I wrote this whole funny conversation with my computer about how horrible my high school was (btw she was very sassy, and yes, I do have many unrepressed feelings about that place LOL). Anyways, I don't know if this is the right place to showcase my immense exuberance, but I guess I now do understand what all the hype is about.
r/Python • u/M4D4R4G0D • Jun 19 '20
I Made This The second version of my simple game. It's still pretty pathetic. But now I have implemented a little object orientation (now my code has classes: P).
r/Python • u/UpAllNate • Oct 08 '22
Discussion Is it just me or did the creators of the Python QT5 GUI library miss a golden opportunity to call the package QtPy?
r/Python • u/[deleted] • Mar 25 '20
I Made This I Used Deep Learning To Identify Naruto (Anime Series) Hand Signs
r/Python • u/DaFluffyPotato • Sep 19 '18
I Made This Super Potato Bruh - A game written entirely in Python/Pygame.
r/Python • u/TechnoLenzer • May 17 '20
I Made This I made an Android app that detects and recognises traffic signs, using Kivy and OpenCV, to help combat traffic casualties worldwide
r/Python • u/[deleted] • Jun 30 '20
I Made This Made a smart rockets simulation with a genetic algorithm
r/Python • u/AnonDoser • Jul 06 '20
I Made This I made an automated machine learning bot that can detect diseases using images within seconds
r/Python • u/RecklessGeek • Feb 11 '20
I Made This I made an app to watch music videos for the songs playing on your PC, while trying to synchronize them.
r/Python • u/eli_mintz • Feb 10 '20
Resource Introducing JustPy: An object-oriented, component based, high-level Python Web Framework that requires no front-end programming. With a few lines of only Python code, you can create interactive websites without any JavaScript programming. Comes with a comprehensive tutorial
JustPy
Introduction
JustPy is an object-oriented, component based, high-level Python Web Framework that requires no front-end programming. With a few lines of only Python code, you can create interactive websites without any JavaScript programming.
Unlike other web frameworks, JustPy has no front-end/back-end distinction. All programming is done on the back-end allowing a simpler, more productive, and more Pythonic web development experience. JustPy removes the front-end/back-end distinction by intercepting the relevant events on the front-end and sending them to the back-end to be processed.
In JustPy, elements on the web page are instances of component classes. A component in JustPy is a Python class that allows you to instantiate reusable custom elements whose functionality and design is encapsulated away from the rest of your code.
Custom components can be created using other components as building blocks. Out of the box, JustPy comes with support for HTML and SVG components as well as more complex components such as charts and grids. It also supports most of the components and the functionality of the Quasar library of Material Design 2.0 components.
JustPy encourages creating your own components and reusing them in different projects (and, if applicable, sharing these components with others).
JustPy supports visualization using matplotlib and Highcharts.
JustPy integrates nicely with pandas and simplifies building web sites based on pandas analysis. JustPy comes with a pandas extension that makes it simple to create interactive charts and grids from pandas data structures.
For updates and news please follow the JustPy Twitter account
Hello World!
import justpy as jp
def hello_world():
wp = jp.WebPage()
d = jp.Div(text='Hello world!')
wp.add(d)
return wp
jp.justpy(hello_world)The program above activates a web server that returns a web page with 'Hello world!' for any request. Locally, you would direct your browser to http://127.0.0.1:8000 or http://localhost:8000/ or to see the result.
Here is a slightly modified version in which 'Hello world!' changes to 'I was clicked!' when it is clicked.
import justpy as jp
def my_click(self, msg):
self.text = 'I was clicked!'
def hello_world():
wp = jp.WebPage()
d = jp.Div(text='Hello world!')
d.on('click', my_click)
wp.add(d)
return wp
jp.justpy(hello_world)Many other examples can be found in the tutorial
Under the Hood
JustPy's backend is built using:
starlette - "a lightweight ASGI framework/toolkit, which is ideal for building high performance asyncio services".
uvicorn - "a lightning-fast ASGI server, built on uvloop and httptools".
JustPy's frontend (which is transparent to JustPy developers) is built using:
Vue.js - "The Progressive JavaScript Framework"
The way JustPy removes the frontend/backend distinction is by intercepting the relevant events on the frontend and sending them to the backend to be processed.
License
r/Python • u/bathon • Aug 10 '19
Approx 6 months back. I was asking help to practice and learn python in this sub. With the support of this sub yesterday I contributed in one of the DL project of arrow and color detection at the right spot which is to be implemented in self driving rovers. Thank you all.
r/Python • u/StPeteTy • Feb 18 '21
Beginner Showcase I just had a baby, so naturally I had to program a tool for deciphering his schedule
(TLDR at the bottom)
THE SITUATION
My son came into the world last month and, as first time parents, we've had a hard time handling his hectic feeding schedule. He would burst into screams, and we'd scramble to get a bottle prepared/warmed. However there wasn't a very good way to know how much milk to warm (once you heat it, it has to be either consumed or discarded). And since a bottle takes 5+ minutes to heat up, we'd spend that time fumbling to soothe him until it was ready. After one-to-two weeks of this, I decided to do something about it.
That's why I created a Python project to take out the guesswork! From the beginning, we were logging all of his feeds because we wanted to make sure he was eating enough (and wasn't eating too much). We use a shared Google Keep note because that's the easiest/quickest way to do it on our phones. And since we'd already gotten into the habit of logging data, I figured 'why not use it to predict when the next bottle will be demanded?'
WHAT IT DOES
The program scrapes all of the content from the Google Keep note and then uses it to estimate the next feed. This estimation includes not only the time, but also the quantity of milk to prepare. It's based on the patterns exhibited over the prior three days, and takes into account both his bottle feeds and his direct breastfeeds. My original goal was to create a legitimate predictive model of his feed patterns, but it quickly became apparent that an explicit model wouldn't be the best strategy (largely due to the irregularity of the feed time data points).
Once it has crunched the data, the program emails both of us with the outputs. Each email contains two distinct sections: the estimates and the summary. The estimates are the metrics related to the next anticipated bottle (feed time and milk quantity) and they've been pretty accurate so far. The summary includes things like average total daily intake / average feed size / average time between feeds / etc. It's just something I threw in to give us some trending insight, but it's turned out to be immensely helpful -- particularly when answering questions at the pediatrician's office.
ADMIN/SETUP
The program is 100% Python, but it does include some non-standard libraries: gkeepapi and pandas. Unfortunately, Google doesn't support API access for Google Keep (why not??) and we weren't willing to change the way we log data. But luckily gkeepapi exists, and that has proven to work great. The downside is that frequently accessing the Keep note through unofficial means caused Google to regularly prompt me to verify my account activity, which got very old very quickly. To mitigate that, I added a feature in the program to only check the note when there's likely to be new information there. Since adding that, Google has stopped bugging me about it.
Using Launchd, I've scheduled the program to run every ten minutes. It can obviously be run manually as well, but it can be run as often as desired. Even if it's run very frequently, it won't access the Keep note or send an email unless there's likely to be new data to consider.
One goal for this project was that the Google Keep note wouldn't have to change formats from what we'd been doing from the start (we wanted to keep formatting the note lines in the way that was easiest/most intuitive for us). As a result, the format which will allow the program to interpret dates/times/quantities is somewhat rigid. Anyone who uses the program will need to emulate our log style or rewrite the code which extracts data. Another goal for the project was that I'd get some pandas practice in. I admit that pandas was likely overkill for this application, but I wanted to get some experience using it and this project has definitely helped me with the basics.
NOTES
The mins/maxes for the time between feeds and the quantities of milk are based on standards for the baby's age (stored in age_info.txt). My son has been fairly consistent/normal with his feeds, so the generally accepted mins/maxes work just fine. But if -- for example -- a baby wanted to eat every hour, the minimum milk quantity per feed would probably be too much.
Since I made this project for my own use and don't really expect other people to use it, there are some hardcoded values. Nothing major -- just people's names for the email, and the note ID for accessing the Google Keep note.
TLDR: The program reads a Google Keep note of baby feed data and sends out an email about how/when to prepare the next bottle. It's been very useful. :)
r/Python • u/seppeEnZigie • Dec 26 '19
I created an AI to play "Flappy Bird": my first steps into AI (using Pygame and NEAT-python)
r/Python • u/newcleardrew • Jun 09 '18
TIL that seaborn refuses to use the jet color scheme in a most wonderful fashion
r/Python • u/GettingBlockered • Oct 24 '22
News Python 3.11 is out! Huzzah!
https://www.python.org/downloads/release/python-3110/
Some highlights from the release notes:
PERFORMANCE: 10-60% faster code, for free!
ERROR HANDLING: Exception groups and except* syntax. Also includes precise error locations in tracebacks.
ASYNCIO: Task groups
TOML: Ability to parse TOML is part of the standard library.
REGEX: Atomic grouping and possessive quantifiers are now supported
Plus changes to typing and a lot more. Congrats to everyone that worked hard to make this happen. Your work is helping millions of people to build awesome stuff. 🎉
r/Python • u/stefantalpalaru • Oct 12 '19
more than 100 scientific articles may be invalidated because scientists assumed that the output of glob.glob() is sorted
r/Python • u/[deleted] • Aug 02 '20
Beginner Showcase I made a video with 3 projects for beginners. The projects cover game development, web scraping, and automation. All the code is in the description, feel free to play around with it!
If you're trying to learn Python, I made a video with some projects that are ready to be added to your resume. These projects try to take advantage of what has been recently going on in the world, while keeping it simple for beginners to code. Here's a link to the video:
I'm also leaving the direct GitHub links of the projects!
Corona Invader (is a replica of the famous Space Invader, with a twist. In the game, you impersonate the Unites States, and you will have to beat the coronavirus by shooting syringes or vaccines, depending on your imagination): https://github.com/DavideMerlin/Corona_Invaders
Election Scraper (This python script scrapes tweets from specific users and organizes them in a convenient CSV file. The goal is to collect tweets about the 2020 election and perform sentiment analysis on them at a later time): https://github.com/DavideMerlin/Twitter_election_scraper
Login Automation (This python scripts uses Selenium to automate the stack overflow's login page): https://github.com/DavideMerlin/Automated_login
Any feedback would be much appreciated too!
r/Python • u/mutatedllama • Apr 13 '20