Python 寫小游戲吃金幣+打乒乓+滑雪(附源碼)
1、吃金幣
源碼分享:
import os import cfg import sys import pygame import random from modules import * ? ? '''游戲初始化''' def initGame(): ? ? # 初始化pygame, 設(shè)置展示窗口 ? ? pygame.init() ? ? screen = pygame.display.set_mode(cfg.SCREENSIZE) ? ? pygame.display.set_caption('catch coins —— 九歌') ? ? # 加載必要的游戲素材 ? ? game_images = {} ? ? for key, value in cfg.IMAGE_PATHS.items(): ? ? ? ? if isinstance(value, list): ? ? ? ? ? ? images = [] ? ? ? ? ? ? for item in value: images.append(pygame.image.load(item)) ? ? ? ? ? ? game_images[key] = images ? ? ? ? else: ? ? ? ? ? ? game_images[key] = pygame.image.load(value) ? ? game_sounds = {} ? ? for key, value in cfg.AUDIO_PATHS.items(): ? ? ? ? if key == 'bgm': continue ? ? ? ? game_sounds[key] = pygame.mixer.Sound(value) ? ? # 返回初始化數(shù)據(jù) ? ? return screen, game_images, game_sounds ? ? '''主函數(shù)''' def main(): ? ? # 初始化 ? ? screen, game_images, game_sounds = initGame() ? ? # 播放背景音樂 ? ? pygame.mixer.music.load(cfg.AUDIO_PATHS['bgm']) ? ? pygame.mixer.music.play(-1, 0.0) ? ? # 字體加載 ? ? font = pygame.font.Font(cfg.FONT_PATH, 40) ? ? # 定義hero ? ? hero = Hero(game_images['hero'], position=(375, 520)) ? ? # 定義食物組 ? ? food_sprites_group = pygame.sprite.Group() ? ? generate_food_freq = random.randint(10, 20) ? ? generate_food_count = 0 ? ? # 當(dāng)前分?jǐn)?shù)/歷史最高分 ? ? score = 0 ? ? highest_score = 0 if not os.path.exists(cfg.HIGHEST_SCORE_RECORD_FILEPATH) else int(open(cfg.HIGHEST_SCORE_RECORD_FILEPATH).read()) ? ? # 游戲主循環(huán) ? ? clock = pygame.time.Clock() ? ? while True: ? ? ? ? # --填充背景 ? ? ? ? screen.fill(0) ? ? ? ? screen.blit(game_images['background'], (0, 0)) ? ? ? ? # --倒計(jì)時(shí)信息 ? ? ? ? countdown_text = 'Count down: ' + str((90000 - pygame.time.get_ticks()) // 60000) + ":" + str((90000 - pygame.time.get_ticks()) // 1000 % 60).zfill(2) ? ? ? ? countdown_text = font.render(countdown_text, True, (0, 0, 0)) ? ? ? ? countdown_rect = countdown_text.get_rect() ? ? ? ? countdown_rect.topright = [cfg.SCREENSIZE[0]-30, 5] ? ? ? ? screen.blit(countdown_text, countdown_rect) ? ? ? ? # --按鍵檢測(cè) ? ? ? ? for event in pygame.event.get(): ? ? ? ? ? ? if event.type == pygame.QUIT: ? ? ? ? ? ? ? ? pygame.quit() ? ? ? ? ? ? ? ? sys.exit() ? ? ? ? key_pressed = pygame.key.get_pressed() ? ? ? ? if key_pressed[pygame.K_a] or key_pressed[pygame.K_LEFT]: ? ? ? ? ? ? hero.move(cfg.SCREENSIZE, 'left') ? ? ? ? if key_pressed[pygame.K_d] or key_pressed[pygame.K_RIGHT]: ? ? ? ? ? ? hero.move(cfg.SCREENSIZE, 'right') ? ? ? ? # --隨機(jī)生成食物 ? ? ? ? generate_food_count += 1 ? ? ? ? if generate_food_count > generate_food_freq: ? ? ? ? ? ? generate_food_freq = random.randint(10, 20) ? ? ? ? ? ? generate_food_count = 0 ? ? ? ? ? ? food = Food(game_images, random.choice(['gold',] * 10 + ['apple']), cfg.SCREENSIZE) ? ? ? ? ? ? food_sprites_group.add(food) ? ? ? ? # --更新食物 ? ? ? ? for food in food_sprites_group: ? ? ? ? ? ? if food.update(): food_sprites_group.remove(food) ? ? ? ? # --碰撞檢測(cè) ? ? ? ? for food in food_sprites_group: ? ? ? ? ? ? if pygame.sprite.collide_mask(food, hero): ? ? ? ? ? ? ? ? game_sounds['get'].play() ? ? ? ? ? ? ? ? food_sprites_group.remove(food) ? ? ? ? ? ? ? ? score += food.score ? ? ? ? ? ? ? ? if score > highest_score: highest_score = score ? ? ? ? # --畫hero ? ? ? ? hero.draw(screen) ? ? ? ? # --畫食物 ? ? ? ? food_sprites_group.draw(screen) ? ? ? ? # --顯示得分 ? ? ? ? score_text = f'Score: {score}, Highest: {highest_score}' ? ? ? ? score_text = font.render(score_text, True, (0, 0, 0)) ? ? ? ? score_rect = score_text.get_rect() ? ? ? ? score_rect.topleft = [5, 5] ? ? ? ? screen.blit(score_text, score_rect) ? ? ? ? # --判斷游戲是否結(jié)束 ? ? ? ? if pygame.time.get_ticks() >= 90000: ? ? ? ? ? ? break ? ? ? ? # --更新屏幕 ? ? ? ? pygame.display.flip() ? ? ? ? clock.tick(cfg.FPS) ? ? # 游戲結(jié)束, 記錄最高分并顯示游戲結(jié)束畫面 ? ? fp = open(cfg.HIGHEST_SCORE_RECORD_FILEPATH, 'w') ? ? fp.write(str(highest_score)) ? ? fp.close() ? ? return showEndGameInterface(screen, cfg, score, highest_score) ? ? '''run''' if __name__ == '__main__': ? ? while main(): ? ? ? ? pass
2、打乒乓
源碼分享:
?import sys import cfg import pygame from modules import * ? ? '''定義按鈕''' def Button(screen, position, text, button_size=(200, 50)): ? ? left, top = position ? ? bwidth, bheight = button_size ? ? pygame.draw.line(screen, (150, 150, 150), (left, top), (left+bwidth, top), 5) ? ? pygame.draw.line(screen, (150, 150, 150), (left, top-2), (left, top+bheight), 5) ? ? pygame.draw.line(screen, (50, 50, 50), (left, top+bheight), (left+bwidth, top+bheight), 5) ? ? pygame.draw.line(screen, (50, 50, 50), (left+bwidth, top+bheight), (left+bwidth, top), 5) ? ? pygame.draw.rect(screen, (100, 100, 100), (left, top, bwidth, bheight)) ? ? font = pygame.font.Font(cfg.FONTPATH, 30) ? ? text_render = font.render(text, 1, (255, 235, 205)) ? ? return screen.blit(text_render, (left+50, top+10)) ? ? ''' Function: ? ? 開始界面 Input: ? ? --screen: 游戲界面 Return: ? ? --game_mode: 1(單人模式)/2(雙人模式) ''' def startInterface(screen): ? ? clock = pygame.time.Clock() ? ? while True: ? ? ? ? screen.fill((41, 36, 33)) ? ? ? ? button_1 = Button(screen, (150, 175), '1 Player') ? ? ? ? button_2 = Button(screen, (150, 275), '2 Player') ? ? ? ? for event in pygame.event.get(): ? ? ? ? ? ? if event.type == pygame.QUIT: ? ? ? ? ? ? ? ? pygame.quit() ? ? ? ? ? ? ? ? sys.exit() ? ? ? ? ? ? if event.type == pygame.MOUSEBUTTONDOWN: ? ? ? ? ? ? ? ? if button_1.collidepoint(pygame.mouse.get_pos()): ? ? ? ? ? ? ? ? ? ? return 1 ? ? ? ? ? ? ? ? elif button_2.collidepoint(pygame.mouse.get_pos()): ? ? ? ? ? ? ? ? ? ? return 2 ? ? ? ? clock.tick(10) ? ? ? ? pygame.display.update() ? ? '''結(jié)束界面''' def endInterface(screen, score_left, score_right): ? ? clock = pygame.time.Clock() ? ? font1 = pygame.font.Font(cfg.FONTPATH, 30) ? ? font2 = pygame.font.Font(cfg.FONTPATH, 20) ? ? msg = 'Player on left won!' if score_left > score_right else 'Player on right won!' ? ? texts = [font1.render(msg, True, cfg.WHITE), ? ? ? ? ? ? font2.render('Press ESCAPE to quit.', True, cfg.WHITE), ? ? ? ? ? ? font2.render('Press ENTER to continue or play again.', True, cfg.WHITE)] ? ? positions = [[120, 200], [155, 270], [80, 300]] ? ? while True: ? ? ? ? screen.fill((41, 36, 33)) ? ? ? ? for event in pygame.event.get(): ? ? ? ? ? ? if event.type == pygame.QUIT: ? ? ? ? ? ? ? ? pygame.quit() ? ? ? ? ? ? ? ? sys.exit() ? ? ? ? ? ? if event.type == pygame.KEYDOWN: ? ? ? ? ? ? ? ? if event.key == pygame.K_RETURN: ? ? ? ? ? ? ? ? ? ? return ? ? ? ? ? ? ? ? elif event.key == pygame.K_ESCAPE: ? ? ? ? ? ? ? ? ? ? sys.exit() ? ? ? ? ? ? ? ? ? ? pygame.quit() ? ? ? ? for text, pos in zip(texts, positions): ? ? ? ? ? ? screen.blit(text, pos) ? ? ? ? clock.tick(10) ? ? ? ? pygame.display.update() ? ? '''運(yùn)行游戲Demo''' def runDemo(screen): ? ? # 加載游戲素材 ? ? hit_sound = pygame.mixer.Sound(cfg.HITSOUNDPATH) ? ? goal_sound = pygame.mixer.Sound(cfg.GOALSOUNDPATH) ? ? pygame.mixer.music.load(cfg.BGMPATH) ? ? pygame.mixer.music.play(-1, 0.0) ? ? font = pygame.font.Font(cfg.FONTPATH, 50) ? ? # 開始界面 ? ? game_mode = startInterface(screen) ? ? # 游戲主循環(huán) ? ? # --左邊球拍(ws控制, 僅雙人模式時(shí)可控制) ? ? score_left = 0 ? ? racket_left = Racket(cfg.RACKETPICPATH, 'LEFT', cfg) ? ? # --右邊球拍(↑↓控制) ? ? score_right = 0 ? ? racket_right = Racket(cfg.RACKETPICPATH, 'RIGHT', cfg) ? ? # --球 ? ? ball = Ball(cfg.BALLPICPATH, cfg) ? ? clock = pygame.time.Clock() ? ? while True: ? ? ? ? for event in pygame.event.get(): ? ? ? ? ? ? if event.type == pygame.QUIT: ? ? ? ? ? ? ? ? pygame.quit() ? ? ? ? ? ? ? ? sys.exit(-1) ? ? ? ? screen.fill((41, 36, 33)) ? ? ? ? # 玩家操作 ? ? ? ? pressed_keys = pygame.key.get_pressed() ? ? ? ? if pressed_keys[pygame.K_UP]: ? ? ? ? ? ? racket_right.move('UP') ? ? ? ? elif pressed_keys[pygame.K_DOWN]: ? ? ? ? ? ? racket_right.move('DOWN') ? ? ? ? if game_mode == 2: ? ? ? ? ? ? if pressed_keys[pygame.K_w]: ? ? ? ? ? ? ? ? racket_left.move('UP') ? ? ? ? ? ? elif pressed_keys[pygame.K_s]: ? ? ? ? ? ? ? ? racket_left.move('DOWN') ? ? ? ? else: ? ? ? ? ? ? racket_left.automove(ball) ? ? ? ? # 球運(yùn)動(dòng) ? ? ? ? scores = ball.move(ball, racket_left, racket_right, hit_sound, goal_sound) ? ? ? ? score_left += scores[0] ? ? ? ? score_right += scores[1] ? ? ? ? # 顯示 ? ? ? ? # --分隔線 ? ? ? ? pygame.draw.rect(screen, cfg.WHITE, (247, 0, 6, 500)) ? ? ? ? # --球 ? ? ? ? ball.draw(screen) ? ? ? ? # --拍 ? ? ? ? racket_left.draw(screen) ? ? ? ? racket_right.draw(screen) ? ? ? ? # --得分 ? ? ? ? screen.blit(font.render(str(score_left), False, cfg.WHITE), (150, 10)) ? ? ? ? screen.blit(font.render(str(score_right), False, cfg.WHITE), (300, 10)) ? ? ? ? if score_left == 11 or score_right == 11: ? ? ? ? ? ? return score_left, score_right ? ? ? ? clock.tick(100) ? ? ? ? pygame.display.update() ? ? '''主函數(shù)''' def main(): ? ? # 初始化 ? ? pygame.init() ? ? pygame.mixer.init() ? ? screen = pygame.display.set_mode((cfg.WIDTH, cfg.HEIGHT)) ? ? pygame.display.set_caption('pingpong —— 九歌') ? ? # 開始游戲 ? ? while True: ? ? ? ? score_left, score_right = runDemo(screen) ? ? ? ? endInterface(screen, score_left, score_right) ? ? '''run''' if __name__ == '__main__': ? ? main()
3、滑雪
源碼分享:
?import sys import cfg import pygame import random ? ? '''滑雪者類''' class SkierClass(pygame.sprite.Sprite): ? ? def __init__(self): ? ? ? ? pygame.sprite.Sprite.__init__(self) ? ? ? ? # 滑雪者的朝向(-2到2) ? ? ? ? self.direction = 0 ? ? ? ? self.imagepaths = cfg.SKIER_IMAGE_PATHS[:-1] ? ? ? ? self.image = pygame.image.load(self.imagepaths[self.direction]) ? ? ? ? self.rect = self.image.get_rect() ? ? ? ? self.rect.center = [320, 100] ? ? ? ? self.speed = [self.direction, 6-abs(self.direction)*2] ? ? '''改變滑雪者的朝向. 負(fù)數(shù)為向左,正數(shù)為向右,0為向前''' ? ? def turn(self, num): ? ? ? ? self.direction += num ? ? ? ? self.direction = max(-2, self.direction) ? ? ? ? self.direction = min(2, self.direction) ? ? ? ? center = self.rect.center ? ? ? ? self.image = pygame.image.load(self.imagepaths[self.direction]) ? ? ? ? self.rect = self.image.get_rect() ? ? ? ? self.rect.center = center ? ? ? ? self.speed = [self.direction, 6-abs(self.direction)*2] ? ? ? ? return self.speed ? ? '''移動(dòng)滑雪者''' ? ? def move(self): ? ? ? ? self.rect.centerx += self.speed[0] ? ? ? ? self.rect.centerx = max(20, self.rect.centerx) ? ? ? ? self.rect.centerx = min(620, self.rect.centerx) ? ? '''設(shè)置為摔倒?fàn)顟B(tài)''' ? ? def setFall(self): ? ? ? ? self.image = pygame.image.load(cfg.SKIER_IMAGE_PATHS[-1]) ? ? '''設(shè)置為站立狀態(tài)''' ? ? def setForward(self): ? ? ? ? self.direction = 0 ? ? ? ? self.image = pygame.image.load(self.imagepaths[self.direction]) ? ? ''' Function: ? ? 障礙物類 Input: ? ? img_path: 障礙物圖片路徑 ? ? location: 障礙物位置 ? ? attribute: 障礙物類別屬性 ''' class ObstacleClass(pygame.sprite.Sprite): ? ? def __init__(self, img_path, location, attribute): ? ? ? ? pygame.sprite.Sprite.__init__(self) ? ? ? ? self.img_path = img_path ? ? ? ? self.image = pygame.image.load(self.img_path) ? ? ? ? self.location = location ? ? ? ? self.rect = self.image.get_rect() ? ? ? ? self.rect.center = self.location ? ? ? ? self.attribute = attribute ? ? ? ? self.passed = False ? ? '''移動(dòng)''' ? ? def move(self, num): ? ? ? ? self.rect.centery = self.location[1] - num ? ? '''創(chuàng)建障礙物''' def createObstacles(s, e, num=10): ? ? obstacles = pygame.sprite.Group() ? ? locations = [] ? ? for i in range(num): ? ? ? ? row = random.randint(s, e) ? ? ? ? col = random.randint(0, 9) ? ? ? ? location ?= [col*64+20, row*64+20] ? ? ? ? if location not in locations: ? ? ? ? ? ? locations.append(location) ? ? ? ? ? ? attribute = random.choice(list(cfg.OBSTACLE_PATHS.keys())) ? ? ? ? ? ? img_path = cfg.OBSTACLE_PATHS[attribute] ? ? ? ? ? ? obstacle = ObstacleClass(img_path, location, attribute) ? ? ? ? ? ? obstacles.add(obstacle) ? ? return obstacles ? ? '''合并障礙物''' def AddObstacles(obstacles0, obstacles1): ? ? obstacles = pygame.sprite.Group() ? ? for obstacle in obstacles0: ? ? ? ? obstacles.add(obstacle) ? ? for obstacle in obstacles1: ? ? ? ? obstacles.add(obstacle) ? ? return obstacles ? ? '''顯示游戲開始界面''' def ShowStartInterface(screen, screensize): ? ? screen.fill((255, 255, 255)) ? ? tfont = pygame.font.Font(cfg.FONTPATH, screensize[0]//5) ? ? cfont = pygame.font.Font(cfg.FONTPATH, screensize[0]//20) ? ? title = tfont.render(u'滑雪游戲', True, (255, 0, 0)) ? ? content = cfont.render(u'按任意鍵開始游戲', True, (0, 0, 255)) ? ? trect = title.get_rect() ? ? trect.midtop = (screensize[0]/2, screensize[1]/5) ? ? crect = content.get_rect() ? ? crect.midtop = (screensize[0]/2, screensize[1]/2) ? ? screen.blit(title, trect) ? ? screen.blit(content, crect) ? ? while True: ? ? ? ? for event in pygame.event.get(): ? ? ? ? ? ? if event.type == pygame.QUIT: ? ? ? ? ? ? ? ? pygame.quit() ? ? ? ? ? ? ? ? sys.exit() ? ? ? ? ? ? elif event.type == pygame.KEYDOWN: ? ? ? ? ? ? ? ? return ? ? ? ? pygame.display.update() ? ? '''顯示分?jǐn)?shù)''' def showScore(screen, score, pos=(10, 10)): ? ? font = pygame.font.Font(cfg.FONTPATH, 30) ? ? score_text = font.render("Score: %s" % score, True, (0, 0, 0)) ? ? screen.blit(score_text, pos) ? ? '''更新當(dāng)前幀的游戲畫面''' def updateFrame(screen, obstacles, skier, score): ? ? screen.fill((255, 255, 255)) ? ? obstacles.draw(screen) ? ? screen.blit(skier.image, skier.rect) ? ? showScore(screen, score) ? ? pygame.display.update() ? ? '''主程序''' def main(): ? ? # 游戲初始化 ? ? pygame.init() ? ? pygame.mixer.init() ? ? pygame.mixer.music.load(cfg.BGMPATH) ? ? pygame.mixer.music.set_volume(0.4) ? ? pygame.mixer.music.play(-1) ? ? # 設(shè)置屏幕 ? ? screen = pygame.display.set_mode(cfg.SCREENSIZE) ? ? pygame.display.set_caption('滑雪游戲 —— 九歌') ? ? # 游戲開始界面 ? ? ShowStartInterface(screen, cfg.SCREENSIZE) ? ? # 實(shí)例化游戲精靈 ? ? # --滑雪者 ? ? skier = SkierClass() ? ? # --創(chuàng)建障礙物 ? ? obstacles0 = createObstacles(20, 29) ? ? obstacles1 = createObstacles(10, 19) ? ? obstaclesflag = 0 ? ? obstacles = AddObstacles(obstacles0, obstacles1) ? ? # 游戲clock ? ? clock = pygame.time.Clock() ? ? # 記錄滑雪的距離 ? ? distance = 0 ? ? # 記錄當(dāng)前的分?jǐn)?shù) ? ? score = 0 ? ? # 記錄當(dāng)前的速度 ? ? speed = [0, 6] ? ? # 游戲主循環(huán) ? ? while True: ? ? ? ? # --事件捕獲 ? ? ? ? for event in pygame.event.get(): ? ? ? ? ? ? if event.type == pygame.QUIT: ? ? ? ? ? ? ? ? pygame.quit() ? ? ? ? ? ? ? ? sys.exit() ? ? ? ? ? ? if event.type == pygame.KEYDOWN: ? ? ? ? ? ? ? ? if event.key == pygame.K_LEFT or event.key == pygame.K_a: ? ? ? ? ? ? ? ? ? ? speed = skier.turn(-1) ? ? ? ? ? ? ? ? elif event.key == pygame.K_RIGHT or event.key == pygame.K_d: ? ? ? ? ? ? ? ? ? ? speed = skier.turn(1) ? ? ? ? # --更新當(dāng)前游戲幀的數(shù)據(jù) ? ? ? ? skier.move() ? ? ? ? distance += speed[1] ? ? ? ? if distance >= 640 and obstaclesflag == 0: ? ? ? ? ? ? obstaclesflag = 1 ? ? ? ? ? ? obstacles0 = createObstacles(20, 29) ? ? ? ? ? ? obstacles = AddObstacles(obstacles0, obstacles1) ? ? ? ? if distance >= 1280 and obstaclesflag == 1: ? ? ? ? ? ? obstaclesflag = 0 ? ? ? ? ? ? distance -= 1280 ? ? ? ? ? ? for obstacle in obstacles0: ? ? ? ? ? ? ? ? obstacle.location[1] = obstacle.location[1] - 1280 ? ? ? ? ? ? obstacles1 = createObstacles(10, 19) ? ? ? ? ? ? obstacles = AddObstacles(obstacles0, obstacles1) ? ? ? ? for obstacle in obstacles: ? ? ? ? ? ? obstacle.move(distance) ? ? ? ? # --碰撞檢測(cè) ? ? ? ? hitted_obstacles = pygame.sprite.spritecollide(skier, obstacles, False) ? ? ? ? if hitted_obstacles: ? ? ? ? ? ? if hitted_obstacles[0].attribute == "tree" and not hitted_obstacles[0].passed: ? ? ? ? ? ? ? ? score -= 50 ? ? ? ? ? ? ? ? skier.setFall() ? ? ? ? ? ? ? ? updateFrame(screen, obstacles, skier, score) ? ? ? ? ? ? ? ? pygame.time.delay(1000) ? ? ? ? ? ? ? ? skier.setForward() ? ? ? ? ? ? ? ? speed = [0, 6] ? ? ? ? ? ? ? ? hitted_obstacles[0].passed = True ? ? ? ? ? ? elif hitted_obstacles[0].attribute == "flag" and not hitted_obstacles[0].passed: ? ? ? ? ? ? ? ? score += 10 ? ? ? ? ? ? ? ? obstacles.remove(hitted_obstacles[0]) ? ? ? ? # --更新屏幕 ? ? ? ? updateFrame(screen, obstacles, skier, score) ? ? ? ? clock.tick(cfg.FPS) ? ? '''run''' if __name__ == '__main__': ? ? main();
到此這篇關(guān)于Python 寫小游戲吃金幣+打乒乓+滑雪(附源碼)的文章就介紹到這了,更多相關(guān)Python 寫小游戲內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Android申請(qǐng)相機(jī)權(quán)限和讀寫權(quán)限實(shí)例
大家好,本篇文章主要講的是Android申請(qǐng)相機(jī)權(quán)限和讀寫權(quán)限實(shí)例,感興趣的同學(xué)趕快來看一看吧,對(duì)你有幫助的話記得收藏一下2022-02-02Django實(shí)現(xiàn)CAS+OAuth2的方法示例
這篇文章主要介紹了Django實(shí)現(xiàn)CAS+OAuth2的方法示例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10python使用dataframe_image將dataframe表格轉(zhuǎn)為圖片
本文主要介紹了python使用dataframe_image將dataframe表格轉(zhuǎn)為圖片,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2024-01-01python實(shí)現(xiàn)錄屏功能(親測(cè)好用)
這篇文章主要介紹了使python實(shí)現(xiàn)錄屏功能(親測(cè)好用),本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的工作或?qū)W習(xí)具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-03-03python 圖像增強(qiáng)算法實(shí)現(xiàn)詳解
這篇文章主要介紹了python 圖像增強(qiáng)算法實(shí)現(xiàn)詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-01-01使用 python 實(shí)現(xiàn)單人AI 掃雷游戲
這篇文章主要介紹了使用 python 實(shí)現(xiàn)單人AI 掃雷游戲,今天我們用 Python 完成這個(gè)小程序,并且用AI來學(xué)習(xí)并實(shí)現(xiàn)它,需要的朋友可以參考下2021-08-08Python3讀取UTF-8文件及統(tǒng)計(jì)文件行數(shù)的方法
這篇文章主要介紹了Python3讀取UTF-8文件及統(tǒng)計(jì)文件行數(shù)的方法,涉及Python讀取指定編碼文件的相關(guān)技巧,需要的朋友可以參考下2015-05-05Restful_framework視圖組件代碼實(shí)例解析
這篇文章主要介紹了Restful_framework視圖組件代碼實(shí)例解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-11-11