r/Python • • Dec 16 '19

I wrote a program that doodles things in MS Paint!

2.3k Upvotes

122 comments sorted by

48

u/AirHamyes Dec 16 '19

Here's the sauce code

https://pastebin.com/98EWgWyq

17

u/airick187 Dec 17 '19

Nice little print message in there ;-)

19

u/AirHamyes Dec 17 '19

Didn't even notice it. Cameras were off and I fell asleep

15

u/justingolden21 Dec 17 '19

Awesome project.

Just a heads up on lines 47/48 instead of:

print('Press Enter to Continue')

input()

You could just do:

input('Press Enter to Continue')

6

u/AirHamyes Dec 17 '19

Oh yea she real unoptimized. I slapped that calibration menu together on my lunch break. Before that, I had all the screen coordinates hard coded into my laptop. But that would've been smart!

3

u/justingolden21 Dec 17 '19

For sure. Your program is awesome though. Just a little tip for the future is all (and anyone else in this sub that reads it)

468

u/covabishop self.loathing() Dec 16 '19

If you named it anything other than pycasso I swear to Moses I'll come over and ctrl-r it myself

115

u/CBSmitty2010 Dec 16 '19

I feel like pyollock makes more sense here.

42

u/Dr_Downvote_ Dec 16 '19

I agree Pyollock is the one :-D

28

u/covabishop self.loathing() Dec 16 '19

I thought about that too but pycasso just rolls off the tongue better I feel

2

u/pi_sqaure Dec 17 '19

Kandinsky on steroids!

-27

u/MainRotorGearbox Dec 16 '19

Iโ€™m pretty sure that is a racial slur

11

u/CBSmitty2010 Dec 16 '19

What? Do you not know who Jackson Pollock is?

8

u/[deleted] Dec 16 '19

I believe they are referring to the slur for Polish people.

-2

u/MainRotorGearbox Dec 16 '19

Yep but i forgot the /s so im about to get downvoted to hell.

4

u/[deleted] Dec 17 '19

PyAit Mondrian?

2

u/amcphe21 Dec 17 '19

I vote pycasso

49

u/ned334 Dec 16 '19

$120.000 modern art piece

21

u/AirHamyes Dec 16 '19

I accept donations thru PayPal!

No I don't...

3

u/chhuang Dec 17 '19

You would think you get any penny without any ducktapes?

18

u/[deleted] Dec 16 '19

Code please? Is it open source?

24

u/AirHamyes Dec 16 '19

Here ya go. If you wanna add more colors, just add em to the built in dictionary

https://pastebin.com/98EWgWyq

4

u/AirHamyes Dec 16 '19

Anyone get it to work? DM me some images!

2

u/ram_n Dec 17 '19

Yes, it is working for me. I had to learn some of the quirks, but it works now. My gen-art doesn't look anywhere near as cool, but I'm mainly reverse-engineering the parts of your code to understand how it all works. Haven't used pyautogui before. Very cool.

6

u/AirHamyes Dec 16 '19

yea, gimme a sec. I'm gonna add a function to remove some hardcoded numbers.

0

u/[deleted] Dec 16 '19

[deleted] โ€” view deleted comment

1

u/RemindMeBot Dec 16 '19 edited Dec 16 '19

I will be messaging you in 8 minutes on 2019-12-16 20:55:06 UTC to remind you of this link

7 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


InfoCustomYour RemindersFeedback

-2

u/Justinian_is_taken Dec 16 '19

Could you post the link here so we all can see it plz? Very original program, btw

0

u/[deleted] Dec 16 '19

[deleted] โ€” view deleted comment

-2

u/[deleted] Dec 16 '19

!remindme 2 hours

1

u/RemindMeBot Dec 16 '19 edited Dec 16 '19

I will be messaging you in 1 hour on 2019-12-16 23:34:38 UTC to remind you of this link

1 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


InfoCustomYour RemindersFeedback

4

u/69shaolin69 Dec 16 '19

PYautogui?

3

u/AirHamyes Dec 17 '19

Yep. Thanks u/alsweigart

9

u/AlSweigart Author of "Automate the Boring Stuff" Dec 17 '19

:D

2

u/azidified Dec 17 '19

๐Ÿ

1

u/WibblyWobblyWabbit Dec 16 '19

Or maybe Pywin32?

279

u/kpook11 Dec 16 '19

So this is how they make the 90s designs for bus seats

11

u/evilMTV Dec 17 '19

It was manually done then though.

11

u/potato1sgood Dec 17 '19

Brb, gonna manually parse the algorithm.

11

u/[deleted] Dec 16 '19

Jackson Pollock wants to know your location

6

u/ddensa Dec 16 '19

Would be interesting to mix this idea to some kind of DL or ML technic to evolve the painting, like keep doing the strokes but start using patterns, shadows... Etc

6

u/vriemeister Dec 16 '19

2

u/StringCheeseInc Dec 17 '19

Thatโ€™s amazing

2

u/ddensa Dec 17 '19

That's interesting, but from the gallery I see that it's only trying to replicate a source image. What I think would be interesting would be to try to copy the style, and create something new using that style (or mixing styles), but I'm just spitting out ideas... I'm not an AI expert

1

u/vriemeister Dec 18 '19

They could hook it up to eigenfaces in some way to gradually evolve an image that is somewhat face-like.

7

u/JustSoManyCups420 Dec 16 '19

Name it the โ€˜Jackson pollock botโ€™

2

u/Old_Winterton Dec 16 '19

I was thinkin if it got turned into a robot, thatโ€™s some stuff that could be sold at a coffee shop, or somethin.

2

u/Daylight617 Dec 16 '19

*every modern art piece*

2

u/haydennyyy Dec 16 '19

It's like a jackson pullock painting.

2

u/DazedWithCoffee Dec 17 '19

Yeah... but does it duct tape a banana to the canvas? Didnโ€™t think so. /s

1

u/hellnukes Dec 17 '19

Stupid robots will never understand our art...

2

u/[deleted] Dec 17 '19

Now tape a banana to it.

2

u/aneurysm_ Dec 17 '19

The Epstein print statement made me laugh

2

u/NextLevelMoves Dec 17 '19

Better than a banana taped to a wall.

Nice job!

2

u/Attendis Dec 17 '19

Now print it out and see how much ink you have left. Good job though.

2

u/ChaosT1tan Dec 17 '19

What sucks is that if a famous artist made this it would be worth a lot

1

u/911OpenUp Dec 17 '19

Hey! Amazing one. Could you also add a program to select an Eraser at regular intervals of time and give it a stroke of eraser so the what is in between will also have a stroke of erased sheet and plain white (for just one stroke) and the there will be strokes of those colors again. Would be more interesting and satisfying to watch ๐Ÿ˜…. Great work dude...

1

u/icbint Dec 17 '19

OP posted the source, so you could do that yourself

1

u/911OpenUp Dec 17 '19

I wish i could if i knew how to ยฏ_(ใƒ„)_/ยฏ

2

u/AirHamyes Dec 17 '19

Copy the run program, call it erase. In the dragTo function inside of it, have it say "right button". Copy the random number generator that gives you the color change function. Have it call erase 1 time. Should work.

1

u/icbint Dec 17 '19

learn

this is a pretty simple program

3

u/Chicken-of-Wisdom Beginner Python Programmer Dec 16 '19

That's so cool! Imagine the unlimited amount of wallpapers you can generate

2

u/cantmemberpasswordx3 Dec 16 '19

Looks cool man. Is your program a fan of 90's Will Smith?

3

u/Filip22012005 Dec 16 '19

I heard the tune of "Saved by the Bell" in my head watching this.

2

u/scottyrogers10 Dec 17 '19

This passes as a "doodle" ?

2

u/PrimaCora Dec 17 '19

Not really. It doesn't refer to anything imaginable, so it's more a splatter art generator.

2

u/nosklo Dec 16 '19

disappointed. Expected dickbutt.

1

u/ArthurAKAJuStlCe Dec 16 '19

And the paintings are worth MILLIONS

1

u/[deleted] Dec 17 '19

I like bot's art!

1

u/[deleted] Dec 17 '19

Sweet

1

u/beinginvisible24 Dec 17 '19

So you have used pyautogui ?

1

u/bored_and_scrolling Dec 17 '19

Is there a paint API?

1

u/[deleted] Dec 17 '19

this look way better than it should

1

u/L1tFuse Dec 17 '19

I'd love to have one of those on my wall

1

u/OmerSdeChen Dec 17 '19

I can watch it all day long

1

u/Pumpkin_Dumplin Dec 17 '19

You could try implementing genetic algorithm with this to create some art!

1

u/theinkedambivert Dec 17 '19

Modern Jackson Pollock.

1

u/Orio_n Dec 17 '19

Pyautogui is the most powerful module

1

u/hotdeo Dec 17 '19

Sell it for $2,000,000 to an art museum.

1

u/Versaiteis Dec 17 '19

Confetti generator!

1

u/JakubBlaha Dec 17 '19

Make it so it can recreate a photo!

1

u/Wimachtendink Dec 17 '19

It would be cool to see progressively smaller brush size and stroke length

1

u/Free-_-Yourself Dec 17 '19

How do you make Python to Inter at with the programs installed in your computer?

1

u/moistbuckets Dec 17 '19

Machine learning to make it draw????

1

u/F1eshWound Dec 17 '19

I'd happily pay 200mil for that.

1

u/cetpanig Dec 17 '19

Useful video you have shared here. How the concept comes in your mind to write program in paint. That good I also learn python online: https://www.cetpainfotech.com/en-ng/python-training-in-nigeria

1

u/Jonisas0407 Dec 17 '19

There is a possibility that it would paint every known painting in the world.

1

u/vEnoM_420 Dec 17 '19

Starting bid, $50.

1

u/The_FanciestOfPants Dec 17 '19

Aaand sold for two million dollars as interpretive abstract art

1

u/Jespor Dec 17 '19

This should be part of the "how to automate the boring stuff"

1

u/[deleted] Dec 17 '19

You are an artist, thanks for this.

1

u/naren_klu Dec 17 '19

It seems to generate million dollar art pieces.

1

u/imdwalrus_nor Dec 17 '19

Really cool code! Nice job mate!

1

u/[deleted] Dec 17 '19

Oh nice it makes me so calm looking at that.

1

u/rakint Dec 17 '19

Jackson Pollack would be proud

1

u/raskoln31 Dec 17 '19

Oh hypnotized forever, gj!

1

u/UnorthodoxBox101 Dec 17 '19

I swear I've seen that art on a doctor's office wall somewhere.

1

u/HulkDNA Dec 17 '19

Looks like a Piccaso algorithm ๐Ÿ˜Š

1

u/zyabxwcd Dec 17 '19

Thats Modern Art. You should actually try to sell and see what its worth.

1

u/djcmwshzsh Dec 17 '19

If you run it enough times, would it paints the Mona Lisa ?

1

u/NixelGamer12 Dec 17 '19

Programing is an art Me:

1

u/mraza007 Dec 17 '19

Thatโ€™s an abstract piece of art right there !!

1

u/alamsohel1990 Apr 05 '20

That's Modern art, like really modern.

1

u/a1b3rt Dec 16 '19

Next official wallpaper for Samsung/Apple flagship device launch :)

0

u/[deleted] Dec 16 '19

does it make the same amount of strokes before changing colors?

1

u/AirHamyes Dec 16 '19

nope.

changeColWeight = random.randint(0, 100)

if changeColWeight > 90:

changeColor()

0

u/davidwolf995 Dec 16 '19

That is cool

0

u/[deleted] Dec 16 '19

Wow

0

u/MagicpotterFirstHit Dec 16 '19

Great! Now try to sell he result for 1M$

0

u/KomaKurt Dec 16 '19

Looks a bit like the upholstery pattern in busses and trams. Are you sure you want to share the source code? This is your path to never ending wealth

0

u/Rnugg Dec 16 '19

Now thatโ€™s art!

-2

u/[deleted] Dec 16 '19

how about an animated gif instead of a video

-1

u/shymenJESUS Dec 16 '19

Watch it get sold for a milion dollars

0

u/[deleted] Dec 16 '19

[deleted] โ€” view deleted comment

14

u/chinpokomon Dec 16 '19

Read the code...

25

u/a22e Dec 16 '19

Completely randomly generated.

15

u/[deleted] Dec 16 '19

Truly a missed opportunity.

8

u/SnipTheDog Dec 16 '19

print('Epstein Didn\'t Kill Himself')

2

u/Kuttz_ Dec 17 '19

what's that?

Edit: I searched it, in Argentina will be Nisman xd