Итак, я начинающий программист, и я подумал, что было бы круто создать программу Paint в PyGame (Python).
У меня было несколько проблем при этом:
import pygame
class Brush:
def __init__(self, color, x, y, radius, location, center):
self.color = color
self.x = x
self.y = y
self.radius = radius
self.location = location
self.center = center
def draw(self):
pygame.draw.circle(self.location, self.color, self.center, self.radius)
def getMouse(self):
pass
pygame.init()
brushX = 400
brushY = 300
colorWhite = (255, 255, 255)
radius = 15
thickness = 0
width = 800
height = 600
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("Paint")
brush = Brush(colorWhite, brushX, brushY, radius, screen, pos)
run = True
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
brush.draw()
pygame.display.update()
Выше мой код.
Итак, моя проблема в том, как мне получить активное положение мыши и изменить его в классе для Bru sh?
Спасибо!