91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 36.13MB
    文件類(lèi)型: .zip
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-07-23
  • 語(yǔ)言: Python
  • 標(biāo)簽: python??

資源簡(jiǎn)介

python開(kāi)發(fā)鋼琴游戲,使用鍵盤(pán)上的“~1234567890-+”十三個(gè)按鍵就可以彈鋼琴了

資源截圖

代碼片段和文件信息

import?pygame
import?sys
from?pygame.locals?import?*
import?sound
import?cv2

“““
pygame.init()
pygame.mixer.init()

six?=?pygame.mixer.Sound(“A?6.wav“)
six.set_volume(0.5)

sixlow?=?pygame.mixer.Sound(“A?b6.wav“)
sixlow.set_volume(0.5)

seven?=?pygame.mixer.Sound(“B?7.wav“)
seven.set_volume(0.5)

sevenlow?=?pygame.mixer.Sound(“B?b7.wav“)
sevenlow.set_volume(0.5)

onehigh?=?pygame.mixer.Sound(“C?1#.wav“)
onehigh.set_volume(0.5)

one?=?pygame.mixer.Sound(“C?1(C).wav“)
one.set_volume(0.5)

twohigh?=?pygame.mixer.Sound(“D?2#.wav“)
twohigh.set_volume(0.5)

two?=?pygame.mixer.Sound(“D?2.wav“)
two.set_volume(0.5)

threehigh?=?pygame.mixer.Sound(“E?3#.wav“)
threehigh.set_volume(0.5)

three?=?pygame.mixer.Sound(“E?3.wav“)
three.set_volume(0.5)

four?=?pygame.mixer.Sound(“F?4.wav“)
four.set_volume(0.5)

five?=?pygame.mixer.Sound(“G?5.wav“)
five.set_volume(0.5)

fivelow?=?pygame.mixer.Sound(“G?b5.wav“)
fivelow.set_volume(0.5)
“““
image?=?pygame.image.load(“piano.png“)
image_rect?=?image.get_rect()

img?=?cv2.imread(‘piano.png‘)
imgInfo?=?img.shape
height?=?imgInfo[0]
width?=?imgInfo[1]
SIZE?=?(width?height)

screen?=?pygame.display.set_mode((SIZE))
pygame.display.set_caption(“Piano?Game“)

note?=?pygame.image.load(“the?crotchets.png“)
note_rect?=?note.get_rect()
quaver?=?pygame.image.load(“quaver.png“)
quaver_rect?=?note.get_rect()



clock?=?pygame.time.Clock()

while?True:
????for?event?in?pygame.event.get():
????????screen.blit(imageimage_rect)

????????pygame.display.flip()

????????if?event.type?==?QUIT:
????????????pygame.quit()
????????????sys.exit()

????????if?event.type?==?KEYDOWN:
????????????if?event.key?==?K_BACKQUOTE:
????????????????sound.fivelow.play()
????????????????quaver_rect.leftquaver_rect.top?=?5(image_rect.height?-?quaver_rect.height-30)
????????????????screen.blit(quaverquaver_rect)
????????????????pygame.display.flip()

????????????if?event.key?==?K_1:
????????????????sound.sixlow.play()
????????????????note_rect.leftnote_rect.top?=?90(image_rect.height?-?note_rect.height)
????????????????screen.blit(notenote_rect)
????????????????pygame.display.flip()
????????????????
????????????if?event.key?==?K_2:
????????????????sound.sevenlow.play()
????????????????quaver_rect.leftquaver_rect.top?=?165(image_rect.height?-?quaver_rect.height-15)
????????????????screen.blit(quaverquaver_rect)
????????????????pygame.display.flip()
????????????
????????????if?event.key?==?K_3:
????????????????sound.one.play()
????????????????note_rect.leftnote_rect.top?=?250(image_rect.height?-?note_rect.height)
????????????????screen.blit(notenote_rect)
????????????????pygame.display.flip()

????????????if?event.key?==?K_4:
????????????????sound.two.play()
????????????????quaver_rect.leftquaver_rect.top?=?325(image_rect.height?-?quaver_rect.height)
????????????????screen.blit(quaverquaver_rect)
????????????????pygame.display.flip()

??

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-01-05?23:12??Piano\
?????文件??????189006??2007-11-30?11:51??Piano\A?6.wav
?????文件??????265038??2007-11-30?11:44??Piano\A?b6.wav
?????文件??????177486??2007-11-30?11:52??Piano\B?7.wav
?????文件??????237390??2007-11-30?11:45??Piano\B?b7.wav
?????文件??????161358??2007-11-30?11:52??Piano\C?1#.wav
?????文件??????230478??2007-11-30?11:46??Piano\C?1(C).wav
?????文件??????165966??2007-11-30?11:53??Piano\D?2#.wav
?????文件??????218958??2007-11-30?11:47??Piano\D?2.wav
?????文件??????186702??2007-11-30?11:54??Piano\E?3#.wav
?????文件??????239694??2007-11-30?11:48??Piano\E?3.wav
?????文件??????205134??2007-11-30?11:49??Piano\F?4.wav
?????文件??????237390??2007-11-30?11:50??Piano\G?5.wav
?????文件??????269646??2007-11-30?11:43??Piano\G?b5.wav
?????文件???????19456??2019-01-05?22:21??Piano\PianoGame.exe
?????文件????????5086??2019-01-05?22:47??Piano\PianoGame.py
?????目錄???????????0??2019-01-05?22:35??Piano\__pycache__\
?????文件?????????892??2019-01-05?22:35??Piano\__pycache__\sound.cpython-35.pyc
?????目錄???????????0??2019-01-05?22:34??Piano\lib\
?????文件???????88752??2015-06-25?23:15??Piano\lib\VCRUNTIME140.dll
?????文件???????87320??2015-09-13?02:28??Piano\lib\_bz2.pyd
?????文件??????126232??2015-09-13?02:28??Piano\lib\_ctypes.pyd
?????文件??????318232??2015-09-13?02:28??Piano\lib\_decimal.pyd
?????文件?????1399576??2015-09-13?02:29??Piano\lib\_hashlib.pyd
?????文件??????149784??2015-09-13?02:28??Piano\lib\_lzma.pyd
?????目錄???????????0??2019-01-05?22:34??Piano\lib\_markerlib\
?????文件?????????842??2019-01-05?22:34??Piano\lib\_markerlib\__init__.pyc
?????文件????????4160??2019-01-05?22:34??Piano\lib\_markerlib\markers.pyc
?????文件???????25880??2015-09-13?02:29??Piano\lib\_multiprocessing.pyd
?????文件???????69400??2015-09-13?02:29??Piano\lib\_socket.pyd
?????文件?????2066200??2015-09-13?02:30??Piano\lib\_ssl.pyd
............此處省略902個(gè)文件信息

評(píng)論

共有 條評(píng)論