import pygame
from pygame.locals import *
import sys
pos=[0,0,0,0,0,0,0,0,0,0]
pygame.init()
sc = pygame.display.set_mode((300, 300))
pygame.display.set_caption("練習")
while (True):
sc.fill((0,0,255))
pygame.display.update()
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type==MOUSEBUTTONDOWN:
(x,y)=event.pos
x1=int(x/100)+1
y1=int(y/100)+1
p1=-1
h=0
if x1==1:
h=h+1
if y1==1:
h=h+1
if h==2:
p1=7
if p1>0:
pos[p1]=100
h=0
if x1==2:
h=h+1
if y1==1:
h=h+1
if h==2:
p1=8
if p1>0:
pos[p1]=100
h=0
if x1==3:
h=h+1
if y1==1:
h=h+1
if h==2:
p1=9
if p1>0:
pos[p1]=100
h=0
if x1==1:
h=h+1
if y1==2:
h=h+1
if h==2:
p1=4
if p1>0:
pos[p1]=100
h=0
if x1==2:
h=h+1
if y1==2:
h=h+1
if h==2:
p1=5
if p1>0:
pos[p1]=100
h=0
if x1==3:
h=h+1
if y1==2:
h=h+1
if h==2:
p1=6
if p1>0:
pos[p1]=100
h=0
if x1==1:
h=h+1
if y1==3:
h=h+1
if h==2:
p1=1
if p1>0:
pos[p1]=100
h=0
if x1==2:
h=h+1
if y1==3:
h=h+1
if h==2:
p1=2
if p1>0:
pos[p1]=100
h=0
if x1==3:
h=h+1
if y1==3:
h=h+1
if h==2:
p1=3
if p1>0:
pos[p1]=100
print(pos)
最終更新:2018年01月20日 19:26