1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| import time
import pygame
from pygame.locals import *
pygame.init()
root = pygame.display.set_mode((512,512), pygame.NOFRAME)
image = pygame.image.load("trans.png").convert_alpha()
continuer = 1
clic = 0
while continuer:
pygame.draw.rect(root, (255, 255, 255), (0, 0, 512, 10))
root.blit(image, (0, 0))
time.sleep(0.5)
for event in pygame.event.get():
if event.type == KEYUP:
continuer = 0
elif event.type == MOUSEBUTTONDOWN:
x, y = event.pos[0], event.pos[1]
if y >= 0 and y <= 10:
#on est sur la bande où l'on doit cliquer
#si on veut déplacer la fenetre
clic = 1
elif event.type == MOUSEBUTTONUP:
clic = 0
elif event.type == MOUSEMOTION:
if clic:
# ~~ là je suis pas sûr que cela marche correctement
x, y = event.pos[0], event.pos[1]
#c'est juste dessous que je sais comment faire
POSITON_FENETRE_SUR_BUREAU__EN_x += x
POSITON_FENETRE_SUR_BUREAU__EN_y += y
pygame.display.flip() |
Partager