python a simple tkinter gui paint program that uses a line as a paint brush with a colorpicker
# a tkinter paint program using lines as paintbrushes. # colorpicker, brush size, clear are all implemented. import tkinter as tk from tkinter import colorchooser # https://pythonprogrammingsnippets.tumblr.com class PaintApp: def __init__(self, root): self.root = root self.root.title("Line Painter Simple Paint Program") # Create a canvas self.canvas = tk.Canvas(self.root, bg="white", width=500, height=500) # Create a toolbar self.toolbar = tk.Frame(self.root, bg="gray") self.color_button = tk.Button( self.toolbar, text="Color", command=self.choose_color, width=20, height=4) self.brush_size_slider = tk.Scale(self.toolbar, from_=1, to=50, orient=tk.HORIZONTAL, label="Brush Size", command=self.change_brush_size, length=200, width=20, sliderlength=20, showvalue=1) self.clear_button = tk.Button( self.toolbar, text="Clear", command=self.clear_canvas, width=20, height=4) # Pack the toolbar widgets self.color_button.pack(side=tk.LEFT, padx=5, pady=5) self.brush_size_slider.pack(side=tk.LEFT, padx=5, pady=5) self.clear_button.pack(side=tk.LEFT, padx=5, pady=5) # Pack the canvas and toolbar self.canvas.pack(fill=tk.BOTH, expand=1) self.toolbar.pack(side=tk.BOTTOM, fill=tk.X) # Bind mouse events to canvas self.canvas.bind("", self.on_mouse_down) self.canvas.bind("", self.on_mouse_up) self.canvas.bind("", self.on_mouse_move) # Initialize variables self.current_color = "black" self.current_brush_size = 5 self.drawn_items = [] self.previous_canvas = None def choose_color(self): self.current_color = colorchooser.askcolor(title="Choose Color")[1] def change_brush_size(self, value): self.current_brush_size = int(value) def clear_canvas(self): self.canvas.delete("all") self.drawn_items = [] def on_mouse_down(self, event): # store snapshot of previous canvas self.previous_canvas = self.canvas.postscript(colormode='color') # draw a line self.drawn_items.append(self.canvas.create_line( event.x, event.y, event.x, event.y, fill=self.current_color, width=self.current_brush_size)) def on_mouse_up(self, event): pass def on_mouse_move(self, event): self.canvas.coords(self.drawn_items[-1], self.canvas.coords(self.drawn_items[-1])[ 0], self.canvas.coords(self.drawn_items[-1])[1], event.x, event.y) # Initialize the root window root = tk.Tk() app = PaintApp(root) root.mainloop()
1 note
·
View note
I felt the need to share here as well—
Say no to AI art. Please read before commenting. Fan art is cute, putting my art into a parasite machine, without my consent, and throwing up horrifying monsters back at me is not.
We are not fighting technology in this AI fight. We are fighting for ethics. How do I say this clearer? Our stuff gets stolen all the time, we get it, but it is not an excuse to normalize the current conditions of AI art.
These datasets have >>EXACT<< copies of artists’ works and these parasites just profit off the work of others with zero repercussion. No one cares how “careful” you are with your text prompts when the data can still output blatant copies of artists’ work without their permission. And people will do this unknowingly since these programs are so highly accessible now. There are even independent datasets that take from just a handful of artists, that don’t share what artists’ works they use, and create blatant copies of existing work. There’s even private medical records being leaked. Why do you think music is still hard to just fully recreate with AI in comparison? It’s because organizations like the RIAA protect music artists. Visual artists just want similar protection. So, wonderfully for us, Concept Art Association has started working towards the steps of protecting artists and making this an ethical practice. I highly suggest if you care about art, please support. Link to their gofundme here. One small step at a time will make living as an artist today less jarring. Artists will not just sit and cope while we continue to get walked on. For those who apparently do not get it, it is about CONSENT. Again, the datasets contain EXACT copies of artist work without our permission. Even if you use it “correctly” there’s still a chance it’s going to create blatant rip offs. This fight is about not letting these techbros take and take and take for profit just because they can while ignoring the possible harm and consequences of it. This is just ol’ fashioned imperialist behavior with a new hat and WE SEE IT. Thanks for reading!!! Much love!
Here’s the link again to support the gofundme.
11K notes
·
View notes