Skip to main content

PyDraw

This is a drawing program for making sprites, it is still in development and won't be ready for a while.


Harry Syred
(Haz_01)
This is a drawing program for making sprites, it is still in development and won't be ready for a while.
This needs python3.x and PyGames only.
Under Mozilla Public License Version 2.0
Features:
- Colour picker
- Zoom
- Options menu
- Size settings
ToDo List:
- Save
- zoom settings
- Open
- Shortcut

Changes

Links

Home Page
https://github.com/Haz001/PyDraw

Releases

PyDraw https://github.com/Haz001/PyDraw — 22 May, 2019

PyDraw v0.0.2-alpha — 27 May, 2019

PyDraw v0.0.1-alpha — 27 May, 2019

PyDraw v0.0.3-alpha — 7 Jun, 2019

PyDraw v0.0.5-alpha — 6 Jul, 2019

Pygame.org account Comments

  • Alex 2019-05-24 10:14

    Is it third python or Second???

    Harry Syred 2019-05-27 01:39

    3.x
  • plutonion 2019-05-26 16:27

    I've just updated your code. !!! YOU NEED TO INSTALL tkcolorpicker BEFORE !!! The code: import pygame from pygame.gfxdraw import * from tkinter import * from tkcolorpicker import askcolor import json run=True def AskColor(): global penColor #To change it (Because I've declared it after the function.) root_buffer=Tk() #A buffer to stock a screen color_temp=askcolor(parent=root_buffer,alpha=True) #But you can change to False root_buffer.destroy() #And delete the background display (Created by tkinter) if color_temp==None: return penColor else: return color_temp[0] def save(): open('save.json','w').write(json.dumps(pixels, sort_keys=True,indent=4, separators=(',', ': ')) ) def load(): global pixels try: pixels=json.load(open('save.json')) print('save.json have been loaded !') except: print('No save detected !') screen = pygame.display.set_mode((1000,700),pygame.RESIZABLE) #Just create a simple display bg=(0,0,0)#Background penColor=(155,155,155) pixels=[]#All pixels, can be save as a json file later PixelSize=20 while run: PixelSize=max(0,PixelSize) #To not divide by zero. mx,my=pygame.mouse.get_pos() #Get the exact position of mouse cx,cy=int(mx/PixelSize)*PixelSize,int(my/PixelSize)*PixelSize #Convert to box area mouse position screen.fill(bg) rectangle(screen,((cx,cy),(PixelSize,PixelSize)),(255-penColor[0],255-penColor[1],255-penColor[2]) ) #^^^Draw a rectangle with inverted brush's color to see where you paint the pixel ^^^ for i in pixels:#Blit all pixels box(screen,((i['x']*PixelSize,i['y']*PixelSize),(PixelSize,PixelSize)),(i['color'])) for event in pygame.event.get(): if event.type == pygame.QUIT: run=False if event.type == pygame.VIDEORESIZE: screen=pygame.display.set_mode(event.dict['size'],pygame.RESIZABLE) if event.type == pygame.MOUSEBUTTONDOWN: if event.button==1: pixels.append({'x':cx//PixelSize,'y':cy//PixelSize,'color':penColor}) if event.button==4: #Scroll zoom in PixelSize+=5 if event.button==5: #Scroll zoom out PixelSize-=5 if event.type == pygame.KEYDOWN: if event.key == pygame.K_s: save() elif event.key == pygame.K_l: load() elif event.key == pygame.K_DELETE: pixels=[] else: penColor=AskColor() pygame.display.update() pygame.quit()

    Harry Syred 2019-05-27 02:23

    The code on Pastebin lines separated and indented properly to the best of my ability if anyone wants it: https://pastebin.com/aP78CcfT

    Harry Syred 2019-05-27 02:04

    This is a totally different code, firstly mine is 257 lines compared to the 62 you just posted, I used object classes and just PyGame when you used lists and multiple other modules. Also please use PasBin next time or GitHub.