Python库(x)纯小学生(我)自制
程序员文章站
2022-03-19 13:34:14
首先在终端输入(不输入序号):1.pip install ybc_box2.pip install ybc_speech3.pip install ybc_weather4.pip install ybc_poetry5.pip install ybc_face然后在Python编辑器里根目录中新建文件夹langueagex接着在文件夹中新建Python文件all.py在all.py里输入import ybc_box as boximport ybc_speech as spimpor...
首先在终端输入(不输入序号):
1.pip install ybc_box
2.pip install ybc_speech
3.pip install ybc_weather
4.pip install ybc_poetry
5.pip install ybc_face
然后在Python编辑器里根目录中新建文件夹languagex
接着在文件夹中新建Python文件all.py
在all.py里输入
import ybc_box as box
import ybc_speech as sp
import ybc_weather as weather
import ybc_poetry as poetry
import ybc_face as face
def xmsg(st):
e = box.msgbox(st)
return(e)
def xenter(st):
e = box.enterbox(st)
return (e)
def xcode(st):
e = box.codebox(st)
return (e)
#buttonbox:try to use ybc_box.buttonbox()
def xfileopen(title):
e = box.fileopenbox(title)
return (e)
def xint(st):
e = box.intbox(st)
return (e)
def speak(text,voice):
sp.speak(text,voice)
def xin(st):
e = input(st)
return(e)
def xout(st):
print(st)
def xweather(date,city):
if date == "today":
return (weather.today(city))
elif date == "week":
return (weather.week(city))
def xpoetry():
title = box.enterbox('请输入诗词题目')
author = box.enterbox('请输入作者名字')
text = poetry.shici(title,author)
voice1 = box.enterbox('请输入朗读声音(1:男音,2:女音)')
voice = int (voice1)
sp.speak(text,voice)
box.msgbox(text)
def xface():
box.msgbox('欢迎来到人像图片检测仪,运行时可能会有些卡,点OK继续')
box.msgbox('请在接下来的上传框内选择图片')
pic = box.fileopenbox()
res1 = face.gender(pic)
box.msgbox('性别计算中')
res2 = face.age(pic)
res2_1 = str(res2)
box.msgbox('年龄计算中(可能会有偏差)')
res3 = face.beauty(pic)
res3_1 = str(res3)
box.msgbox('颜值计算中(主观判断,不能完全客观)')
box.msgbox('性别:' + res1 + ' ' + '年龄:' + res2_1 + ' ' + '颜值:' + res3_1)
if res3 >= 80:
box.msgbox('颜值超过至少70%的人')
feedback = box.buttonbox('可选择反馈', ['反馈', '退出'])
if feedback == '反馈':
box.enterbox('请输入反馈~(✪ω✪)')
box.msgbox('感谢您的反馈,我们会改进的,感谢使用,┏(^0^)┛')
else:
box.msgbox('感谢使用,┏(^0^)┛')
然后就可以使用了
这里注意每个文件中如要用到,需输入:import languagex.all as x
*此后会陆续更新
本文地址:https://blog.csdn.net/m0_52597864/article/details/109921691
下一篇: 企业网管必看:企业网站常见问题和解决方法