Skip to main content

中文Python内置函数封装库,让你用中文写代码。

Project description

「bttmb 3.1.6 中文Python库完整介绍」

⚽️ 「核心定位」

逐步完善并汉化覆盖 Python 语言,让编程新手也能快速入门学习

🧱 「版本信息」

当前版本:v3.1.6

🀄️ 「已完成汉化模块」

  • 内置函数
  • 高级运算函数
  • 拓展函数
  • turtle库
  • math库
  • random库
  • pygame库(部分)

🧍‍♂️ 「适用人群」

  • 三级以下学生:适配学习,轻松上手
  • 四级及以上:可试用 pygame 模块(玩家向)
  • 大项目(如 sys 等模块):暂无法完成完整中文覆盖

💻 「代码示例」

一、汉化海龟绘图

--python-- import bttmb as 编程 编程.苏醒乌龟(别名="小龟龟") 编程.小龟龟.速度(10)#老玩家注意:speed里的0我搞成了10,新手好懂。 for 次数 in 编程.重复数字(1,11):#新手注意:顾头不顾尾。 编程.小龟龟.前进(100) 编程.小龟龟.后退(100) 编程.小龟龟.左转(36) 编程.小龟龟.隐藏()

二、基础内置函数使用 --python-- import bttmb as bc bc.打印("hahh",678) bc.打印(bc.判断质数(7))

三、Pygame使用 --python-- import bttmb as w w.运行代码(''' import bttmb as w w.苏醒玩家(窗口大小=(1200,800),别名="j") w.苏醒随机('r') 游戏=1 x=w.r.随机数(100,1100) y=w.r.随机数(100,700) 当 游戏: w.j.填充颜色((240,240,240)) if x<=w.j.鼠标状态()[0][0]<=x+50 and y<=w.j.鼠标状态()[0][1]<=y+50: if w.j.鼠标状态()[1][0]: x=w.r.随机数(100,1100) y=w.r.随机数(100,700) else: w.j.画按钮((x,y),(50,50),"Here!",(255,130,130),(0,0,0),20) else: w.j.画按钮((x,y),(50,50),"Here!",(255,160,160),(0,0,0),20) if 10<=w.j.鼠标状态()[0][0]<=60 and 10<=w.j.鼠标状态()[0][1]<=60: if w.j.鼠标状态()[1][0]: w.j.填充颜色((240,240,240)) w.j.写文字("Game Over",(30,300),(50,50,50),300) 游戏=0 else: w.j.画按钮((10,10),(50,50),"Exit",(130,255,130),(0,0,0),20) else: w.j.画按钮((10,10),(50,50),"Exit",(160,255,160),(0,0,0),20) w.j.处理退出() w.j.帧率(70) w.j.退出()''')

✍️ 「作者与相关信息」

  • 作者:BURTTRAVER
  • 投诉&协作邮箱:13149412996@163.com
  • PyPI 直达链接:https://pypi.org/project/bttmb/
  • 版本更新日志:0.4.0 ➡ 2.0.0 ➡ 2.4.5 ➡ 2.4.9 ➡ 2.5.0 ➡ 2.7.0 ➡ 3.0.0 ➡ 3.0.1 ➡ 3.1.0 ➡ 3.1.5 ➡ 3.1.7 ➡ 3.2.0 ➡ 3.2.2 ➡ 3.3.0 ➡ 3.5.0 ➡ 3.5.5 ➡ 3.5.6 ➡ 3.7.0 ➡ 3.7.5 ➡ 3.7.6 ➡ 3.7.9 ➡ 3.9.0 ➡ 4.0.0 ➡ 4.4.5 ➡ 4.4.9 ➡ 4.5.0 ➡ 4.7.0 ➡ 5.0.0 ➡ 5.0.1 ➡ 5.1.0 ➡ 5.1.5 ➡ 5.1.7 ➡ 5.2.0 ➡ 5.2.2 ➡ 5.3.0 ➡ 5.5.0 ➡ 5.5.5 ➡ 5.5.6 ➡ 5.7.0 ➡ 5.7.5 ➡ 5.7.6 ➡ 5.7.9 ➡ 5.9.0 ➡ 6.0.0 ➡ 6.2.0...
  • 仓库地址:仅发布在 PyPI,暂不入驻 GitHub 「喵!中国10岁男孩在GitHub失踪了…因为他没有账号!」 📄 「许可证」

许可证

本项目基于 MIT License 开源。 ⚡️ 作者雷霆大留言 ⚡️ 哦不不不我无疑是愤怒的debug太难了,我xxx 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 2000多行代码千万不要下载,要不然你半辈子看不懂,我根本没注释😅 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 给个活动,谁能把下面代码改成苏醒玩家可以运行的? 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 import pygame import random pygame.init() pygame.display.set_caption('') screen = pygame.display.set_mode((1200,800)) screen.fill((255,255,255)) bg = pygame.image.load('背景.jpg') gun = pygame.image.load('子弹.jpg') mp = [pygame.image.load('我.jpg'),pygame.image.load('我2.jpg')] gun = pygame.transform.scale(gun,(20,100)) dj = [pygame.image.load('敌机.jpg'),pygame.image.load('炸1.jpg'), pygame.image.load('炸2.jpg'),pygame.image.load('炸3.jpg'), pygame.image.load('炸4.jpg')] pt,cx,cy,g,d,djzt,zd,dp,game,score,djxl,dsx,dz = 0,450,500,[],[],[],0,0,True,0,[],[],[] def 画按钮(位置, 大小, 文字, 背景色, 文字色=(255,255,255), 字号=20): 按钮矩形 = pygame.Rect(*位置, *大小) 字体对象 = pygame.font.SysFont("UTF-8", 字号) 文本表面 = 字体对象.render(文字, True, 文字色) 文本矩形 = 文本表面.get_rect(center=按钮矩形.center) def word(content,size,address,color=(255,0,0),font=None): mf = pygame.font.Font(font,size) mf2 = mf.render(content,True,color) screen.blit(mf2,address) pygame.mixer.music.load('game_music.ogg') pygame.mixer.music.set_volume(0.1) pygame.mixer.music.play(-1) fs = pygame.mixer.Sound('敌机坠落.wav') fs.set_volume(0.5) biu = pygame.mixer.Sound('biu.wav') def word_gradient_scroll(content,size,pos,speed=0.0005,font=None): x,y = pos total_len = len(content) t = (pygame.time.get_ticks() * speed) % 1 for i, char in enumerate(content): char_t = i / max(total_len - 1,1) scroll_t = (char_t + t) % 1 r = 255 g = int(255 * scroll_t) b = 0 word(char,size,(x,y), (r,g,b),font) temp_surf = pygame.font.Font(font,size).render(char,True,(r,g,b)) x = x + temp_surf.get_width() + 2 gun = pygame.transform.scale(gun,(10,40)) while True: if game == True: screen.blit(bg,(0,0)) screen.blit(mp[int(pt)],(cx,cy)) for i in range(len(g)): screen.blit(gun,g[i]) zd = zd + 0.2 if zd > 1: zd = 0 if zd % 1 == 0: for i in range(3): g.append((cx+40,cy-70)) screen.blit(gun,g[len(g)-1]) if len(g) != 0 and g[len(g)-1][1] < -100: g.pop() pt = pt + 0.1 if pt >= 2: pt = 0 if cx >= 1100: cx = 1100 if cx <= 0: cx = 0 if cy >= 700: cy = 700 if cy <= 0: cy = 0 for i in reversed(range(len(d))): screen.blit(dj[int(djzt[i])], d[i]) if djzt[i] >= 1: djzt[i] = djzt[i] + 0.3 if djzt[i] >= 5: d.pop(i) djzt.pop(i) djxl.pop(i)
dp = dp + 0.05 if dp > 1: dp = 0 d.append((random.randint(0,1100),0)) if djzt != []: screen.blit(dj[int(djzt[len(djzt)-1])],d[len(d)-1]) djxl.append(54) djzt.append(0) djdzt = random.randint(1,6) if djdzt > 2 and djdzt < 7: dz.append((0,255,0)) elif djdzt == 1: dz.append((0,255,0)) else: dz.append((0,255,0)) for i in range(len(d)): if dz[i] == (0,0,255): d[i] = (d[i][0],d[i][1]+5) else: d[i] = (d[i][0],d[i][1]+5) if len(d) != 0 and d[len(d)-1][1] > 860: d.pop() djxl.pop() dz.pop() keys = pygame.key.get_pressed() for i in range(len(g)): if i % 3 == 0: g[i] = (g[i][0],g[i][1]-30) if i % 3 == 1: g[i] = (g[i][0]+10,g[i][1]-30) if i % 3 == 2: g[i] = (g[i][0]-10,g[i][1]-30) wj = pygame.Rect(cx,cy,105,109) word_gradient_scroll('score:'+str(score),30,(0,0),font=('斜体.TTF')) for i in g: zg = pygame.Rect(i[0],i[1],13,27) for j in d: e = d.index(j) dg = pygame.Rect(j[0],j[1],54,40) if djzt[e] == 0: pygame.draw.rect(screen,(128,128,128),(j[0],j[1]-20,54,10)) pygame.draw.rect(screen,dz[e],(j[0],j[1]-20,djxl[e],10)) if zg.colliderect(dg): if djxl[e] <= 0 and djzt[e] == 0: fs.play() djzt[e] = 1 else: djxl[e] = djxl[e] - 18 biu.play() score = score + 1 if wj.colliderect(dg): game = False pygame.mixer.music.stop() cx,cy = pygame.mouse.get_pos()[0]-50,pygame.mouse.get_pos()[1]-50 else: word('game over',204,(0,298),font=('斜体.TTF')) word('score:'+str(score),100,(0,500),font=('斜体.TTF')) 画按钮((200,200),(50,50),"again!",(255,0,255),(20,20,20),15) for event in pygame.event.get(): if event.type == pygame.QUIT: exit() pygame.display.update() pygame.time.Clock().tick(70) 不是shi山!!!!!!!!!素材放core里了 反正没人愿意🙃 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 严肃,我是绷带转世

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bttmb-3.1.6.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bttmb-3.1.6-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file bttmb-3.1.6.tar.gz.

File metadata

  • Download URL: bttmb-3.1.6.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for bttmb-3.1.6.tar.gz
Algorithm Hash digest
SHA256 35dc166faef3d342040a5677bbe61099c35145f0372f591792b3c5b4e404b341
MD5 c8becc5a1cd867cef430030d63768cd6
BLAKE2b-256 8d2044d4e32d773e50eabd3bb3d7c6ad40e7c2c3896fdd3acca1058ef864ec21

See more details on using hashes here.

File details

Details for the file bttmb-3.1.6-py3-none-any.whl.

File metadata

  • Download URL: bttmb-3.1.6-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for bttmb-3.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 28638887f7b6c95bc369e554518d31a21b0c7978c29e569055d9268de099e286
MD5 350dd4d369d20825c66e1cae2db2691f
BLAKE2b-256 1e66efe6be88754136c395ca54bbfc6a763973b4c82a04052e7f506275d10636

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page