|
import sys
import pygame as pg
pg.init()
screen = pg.display.set_mode((1024,768))
clock = pg.time.Clock()
mstate = 0
while True :
for event in pg.event.get():
if event.type == pg.QUIT:
pg.quit()
sys.exit()
mclick=pg.mouse.get_pressed()
if mclick==(0,0,0):
clock.tick(30)
mstate=0
continue
mx,my=pg.mouse.get_pos()
if mstate==1:
cc=(255*mclick[1],255*mclick[0],255*mclick[2])
pg.draw.line(screen,cc,[px,py],[mx,my],1)
pg.display.flip()
mstate=1
px,py=mx,my |
|