日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

表白编程代码python_python抖音表白程序源代码

發布時間:2025/4/5 python 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 表白编程代码python_python抖音表白程序源代码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

import sys

import random

import pygame

from pygame.locals import *

WIDTH, HEIGHT = 640, 480

BACKGROUND = (0, 191, 255)

# 按鈕

def button(text, x, y, w, h, color, screen):

pygame.draw.rect(screen, color, (x, y, w, h))

font = pygame.font.Font('./font/simkai.ttf', 20)

textRender = font.render(text, True, (0, 0, 0))

textRect = textRender.get_rect()

textRect.center = ((x+w/2), (y+h/2))

screen.blit(textRender, textRect)

# 標題

def title(text, screen, scale, color=(255, 0, 0)):

font = pygame.font.Font('./font/simkai.ttf', WIDTH//(len(text)*2))

textRender = font.render(text, True, color)

textRect = textRender.get_rect()

textRect.midtop = (WIDTH/scale[0], HEIGHT/scale[1])

screen.blit(textRender, textRect)

# 生成隨機的位置坐標

def get_random_pos():

x, y = random.randint(20, 620), random.randint(20, 460)

return x, y

# 點擊喜歡按鈕后顯示的頁面

def show_like_interface(text, screen, color=(255, 0, 0)):

screen.fill(BACKGROUND)

font = pygame.font.Font('./font/simkai.ttf', WIDTH//(len(text)))

textRender = font.render(text, True, color)

textRect = textRender.get_rect()

textRect.midtop = (WIDTH/2, HEIGHT/2)

screen.blit(textRender, textRect)

pygame.display.update()

while True:

for event in pygame.event.get():

if event.type == QUIT:

pygame.quit()

sys.exit()

# 主函數

def main():

pygame.init()

screen = pygame.display.set_mode((WIDTH, HEIGHT), 0, 32)

pygame.display.set_caption('FROM一個喜歡你很久的小哥哥')

clock = pygame.time.Clock()

pygame.mixer.music.load('./bg_music/1.mp3')

pygame.mixer.music.play(-1, 30.0)

pygame.mixer.music.set_volume(0.25)

unlike_pos_x = 330

unlike_pos_y = 300

unlike_pos_width = 100

unlike_pos_height = 50

like_pos_x = 180

like_pos_y = 300

like_pos_width = 100

like_pos_height = 50

running = True

like_color = (255, 0, 255)

while running:

screen.fill(BACKGROUND)

img = pygame.image.load("./imgs/1.png")

imgRect = img.get_rect()

imgRect.midtop = WIDTH//2, HEIGHT//4

screen.blit(img, imgRect)

for event in pygame.event.get():

if event.type == pygame.MOUSEBUTTONDOWN:

mouse_pos = pygame.mouse.get_pos()

if mouse_pos[0] < like_pos_x+like_pos_width+5 and mouse_pos[0] > like_pos_x-5 and\

mouse_pos[1] < like_pos_y+like_pos_height+5 and mouse_pos[1] > like_pos_y-5:

like_color = BACKGROUND

running = False

mouse_pos = pygame.mouse.get_pos()

if mouse_pos[0] < unlike_pos_x+unlike_pos_width+5 and mouse_pos[0] > unlike_pos_x-5 and\

mouse_pos[1] < unlike_pos_y+unlike_pos_height+5 and mouse_pos[1] > unlike_pos_y-5:

while True:

unlike_pos_x, unlike_pos_y = get_random_pos()

if mouse_pos[0] < unlike_pos_x+unlike_pos_width+5 and mouse_pos[0] > unlike_pos_x-5 and\

mouse_pos[1] < unlike_pos_y+unlike_pos_height+5 and mouse_pos[1] > unlike_pos_y-5:

continue

break

title('小姐姐,我觀察你很久了', screen, scale=[2, 10])

title('做我女朋友好不好呀', screen, scale=[2, 6])

button('好呀', like_pos_x, like_pos_y, like_pos_width, like_pos_height, like_color, screen)

button('算了吧', unlike_pos_x, unlike_pos_y, unlike_pos_width, unlike_pos_height, (255, 0, 255), screen)

pygame.display.flip()

pygame.display.update()

clock.tick(60)

show_like_interface('我就知道小姐姐你也喜歡我~', screen, color=(255, 0, 0))

if __name__ == '__main__':

main()

總結

以上是生活随笔為你收集整理的表白编程代码python_python抖音表白程序源代码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。