- C24zhuchengyu's blog
WindowsXP但是Python Edition
- @ 2024-8-28 12:25:53
import pygame
import os
from pygame import transform
pygame.init()
screen = pygame.display.set_mode((480,360))
pygame.display.set_caption("WindowsXP Python-Edition")
fileroad = __file__
folder = os.path.dirname(fileroad)
icon = pygame.image.load(folder + "\icon.ico")
pygame.display.set_icon(icon)
run = True
mode = 0x00
# 0:start computer
# 1:begin page
# 2:main loop
# -1:close page
loadline=[pygame.image.load(folder+"/a0.png"),pygame.image.load(folder+"/a1.png"),pygame.image.load(folder+"/a2.png"),pygame.image.load(folder+"/a3.png"),pygame.image.load(folder+"/a4.png"),pygame.image.load(folder+"/a5.png"),pygame.image.load(folder+"/a6.png"),pygame.image.load(folder+"/a7.png"),pygame.image.load(folder+"/a8.png"),pygame.image.load(folder+"/a9.png"),pygame.image.load(folder+"/a10.png"),pygame.image.load(folder+"/a11.png"),pygame.image.load(folder+"/a12.png"),pygame.image.load(folder+"/a13.png"),pygame.image.load(folder+"/a14.png")]
for i in range(15):
loadline[i]=transform.scale(loadline[i],(165,21))
mouse1=pygame.image.load(folder+"/mouse-normal.png")
mouse2=pygame.image.load(folder+"/mouse-load.png")
mouse3=pygame.image.load(folder+"/mouse-loadToStop.png")
mouserect=mouse1.get_rect()
b0 = pygame.image.load(folder + "/bg0.png")
b1 = pygame.image.load(folder + "/bg1.png")
time=0
wjglq=pygame.image.load(folder+"/wjglq.png")
BGlist=[pygame.image.load(folder+"/mainb1.png")]
RWlist=[pygame.image.load(folder+"/lineb1.png")]
iconlist=[pygame.image.load(folder+"/MYCOMPUTER.png"),pygame.image.load(folder+"/MYCOMPUTER_CHOOSE.png")]
lasttouch=-1
usebg=0
userw=0
px=0
py=0
ned=0
pygame.mouse.set_visible(False)
while run:
time+=1
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
elif event.type == pygame.MOUSEBUTTONDOWN:
px,py=event.pos
if px>=10 and px<=45 and py>=10 and py<=43:
if lasttouch == 1:
lasttouch=0
ned=1
else:
lasttouch=1
else:
lasttouch=-1
if mode == 0x00:
screen.fill((0,0,0))
if time <= 1024:
b0.set_alpha(time/4%256)
else:
b0.set_alpha(255)
screen.blit(b0,(0,0))
now = (time/50)%15
if time > 1024:
if time <= 2048:
loadline[int(now)].set_alpha((time-1024)/4%256)
screen.blit(loadline[int(now)],(157.5,260))
loadline[int(now)].set_alpha(255)
if time > 4096:
mode = 0x01
if mode == 0x01:
screen.fill((0,0,0))
screen.blit(b1,(0,0))
mousepos = pygame.mouse.get_pos()
mouserect.topleft=mousepos
screen.blit(mouse2,mouserect)
if time > 8192:
mode = 0x02
if mode == 0x02:
print("finish begin!")
screen.fill((0,0,0))
screen.blit(BGlist[usebg],(0,0))
screen.blit(RWlist[userw],(0,341))
if lasttouch != 1:screen.blit(iconlist[0],(10,10))
else:screen.blit(iconlist[1],(10,10))
mousepos = pygame.mouse.get_pos()
mouserect.topleft=mousepos
screen.blit(mouse1,mouserect)
if ned == 1:
screen.blit(wjglq,(100,100))
pygame.display.flip()
pygame.quit()
有网就下没有网我也没办法 链接:https://pan.baidu.com/s/1agf8NSrya7OlBOC2fGywwA
提取码:zxxz