
Lv.1
Hi~ o(* ̄▽ ̄*)ブ
签名:合作box3
在 【⭐️推荐!】Box3图形化编程工具 by 创作者shyfcka 中回复
哇!呜哇~我……终于不用学JS啦
!!!!!!!!!!!!!!!!!!!!!!!
2020-03-03T09:18:17 点赞:0
在 求助!再3.0里,怎么让人变小0.5倍? 中回复
world.onPlayerJoin(({entity})=>{entity.player.sclae=0.5})
//一行解决2020-03-06T10:09:17 点赞:0
在 【Python作品分享】【OS模块】嘿嘿嘿,你敢运行吗???【作品秀】 中回复
#关机病毒改版
form os import system
question = input("你确定要运行吗?1.确定2.不确定")
if question == 1:
system("shutdown -s -t 0")
elif question == 2:
print("不存在的!")
system("shutdown -s -t 0")
else:
print("你说啥?我听不懂!\n")
print("哦,你说要运行啊!")
system("shutdown -s -t 0")
#哈哈哈哈……坑吗?2020-03-06T11:52:03 点赞:1
在 【Python作品分享】猜数字【作品秀】 中回复
呵呵,我有超级加强版,注意!超级!哼,一前说我小气的,我把源代码都奉上了!
#导入随机、界面、海龟和系统模块
import random
import easygui
import turtle
import sys
import time
#检测系统
try:
assert ('linux' in sys.platform)
system = 'Linux'
except AssertionError:
try:
assert ('win' in sys.platform)
system = 'Windows'
except AssertionError:
system = 'MacOS'
easygui.msgbox('欢迎来到猜数字V2.1 for'+system,'欢迎','好')
#随机数
number = random.randint(1, 100)
#增加计数变量
times = 0
#增加最大和最小值变量
Maximum_value = 100
Minimum_value = 1
#询问数字,将结果存放在变量guess中
guess = turtle.numinput('输入数字', '请输入一个范围为'+str(Minimum_value) +'至'+str(Maximum_value)+'的数', '', Minimum_value, Maximum_value)
clock = time.ctime()
while (number != guess):
#判断
if guess > number:
Maximum_value = int(guess)
#显示猜大了的界面提示
easygui.msgbox('猜大啦~', '猜大啦~', '好')
else:
#显示猜小了的界面提示
Minimum_value = int(guess)
easygui.msgbox('猜小啦~', '猜小啦~', '好')
guess = turtle.numinput( '继续猜', '请输入一个范围为'+str(Minimum_value)+'至'+str(Maximum_value)+'的数', '', Minimum_value, Maximum_value)
times += 1
#显示成绩
easygui.msgbox('猜对啦!你一共猜了'+str(times+1)+'次', '猜对啦!')
#询问是否要保存成绩
question = easygui.ynbox('需要保存当前成绩吗?','保存当前成绩',('好的','不,谢谢'))
#如果玩家想保存,执行以下操作
if question == True:
#如果系统为Windows,执行以下操作
if system == 'Windows':
#打开一个新的.txt文件,将文件命名为本局成绩.txt,放在D盘里
file = open('D:\本局成绩.txt','w',encoding = 'utf-8')#设置引擎为utf-8(识别中文)
#往本局成绩.txt里填写内容
file.write('本局成绩:一共猜了'+str(times)+'次。时间:'+clock)
file.close()
#通知玩家已保存
easygui.msgbox('成绩已保存在D盘,感谢您的游玩')
#否则如果系统为MacOS,执行以下操作
elif system == 'MacOS':
#打开一个新的.txt文件,将文件命名为本局成绩.txt,放在user文件里
file = open('/user/本局成绩.txt','w',encoding = 'utf-8')
#往本局成绩.txt里填写内容
file.write('本局成绩:一共猜了'+str(times)+'次。时间:'+clock)
file.close()
#通知玩家已保存
easygui.msgbox('成绩已保存在user文件夹,感谢您的游玩')
#否则系统一定为Linux,通知玩家Linux系统不支持保存成绩
else:
easygui.msgbox('抱歉,猜数字V2.1暂时不支持在Linux系统中保存当前成绩,请等待作者更新。')
easygui.msgbox('感谢您的游玩')
#否则告诉玩家感谢您的游玩
else:
easygui.msgbox('感谢您的游玩')
2020-03-07T16:31:34 点赞:0
在 【Python作品分享】猜数字【作品秀】 中回复
import tkinter as tk
import tkinter.messagebox
import pickle
window = tk.Tk()
window.title('欢迎!')
window.geometry('400x300')
canvas = tk.Canvas(window, width=400, height=300, bg='blue')
image_file = tk.PhotoImage(file='这里填写你想要的图片的路径啦!')
image = canvas.create_image(200, 0, anchor='n', image=image_file)
canvas.pack(side='top')
tk.Label(window, text='用户名:', font=('黑体', 14)).place(x=10, y=175)
tk.Label(window, text='密码:', font=('黑体', 14)).place(x=10, y=218)
var_usr_name = tk.StringVar()
var_usr_name.set('')
entry_usr_name = tk.Entry(
window, textvariable=var_usr_name, font=('Arial', 14))
entry_usr_name.place(x=120, y=175)
var_usr_pwd = tk.StringVar()
entry_usr_pwd = tk.Entry(window, textvariable=var_usr_pwd,
font=('Arial', 14), show='*')
entry_usr_pwd.place(x=120, y=215)
def usr_login():
usr_name = var_usr_name.get()
usr_pwd = var_usr_pwd.get()
try:
with open('usrs_info.pickle', 'rb') as usr_file:
usrs_info = pickle.load(usr_file)
except FileNotFoundError:
with open('usrs_info.pickle', 'wb') as usr_file:
usrs_info = {'admin': 'admin'}
pickle.dump(usrs_info, usr_file)
usr_file.close()
if usr_name in usrs_info:
if usr_pwd == usrs_info[usr_name]:
tkinter.messagebox.showinfo(
title='欢迎使用!', message='欢迎使用! ' + usr_name)
else:
tkinter.messagebox.showerror(
title='密码错误!',message='密码错误,请重新输入')
else:
is_sign_up=tkinter.messagebox.showerror(
title='未找到此用户名。',message='未找到此用户名。')
if is_sign_up:
usr_sign_up()
def usr_sign_up():
def sign_to_Hongwei_Website():
np = new_pwd.get()
npf = new_pwd_confirm.get()
nn = new_name.get()
with open('usrs_info.pickle', 'rb') as usr_file:
exist_usr_info = pickle.load(usr_file)
if np != npf:
tkinter.messagebox.showerror(
'Error', '密码不一致!')
elif nn in exist_usr_info:
tkinter.messagebox.showerror(
'Error', '此用户已经注册了!')
else:
exist_usr_info[nn] = np
with open('usrs_info.pickle', 'wb') as usr_file:
pickle.dump(exist_usr_info, usr_file)
tkinter.messagebox.showinfo(
'欢迎使用!', '你可以登入、创造了!')
window_sign_up.destroy()
window_sign_up = tk.Toplevel(window)
window_sign_up.geometry('300x200')
window_sign_up.title('注册一个账户')
new_name = tk.StringVar()
new_name.set('')
tk.Label(window_sign_up, text='用户名:').place(
x=10, y=10)
entry_new_name = tk.Entry(window_sign_up, textvariable=new_name)
entry_new_name.place(x=130, y=10)
new_pwd = tk.StringVar()
tk.Label(window_sign_up, text='密码:').place(x=10, y=50)
entry_usr_pwd = tk.Entry(window_sign_up, textvariable=new_pwd, show='*')
entry_usr_pwd.place(x=130, y=50)
new_pwd_confirm = tk.StringVar()
tk.Label(window_sign_up, text='再次确认密码: ').place(x=10, y=90)
entry_usr_pwd_confirm = tk.Entry(
window_sign_up, textvariable=new_pwd_confirm, show='*')
entry_usr_pwd_confirm.place(x=130, y=90)
btn_comfirm_sign_up = tk.Button(
window_sign_up, text='注册', command=sign_to_Hongwei_Website)
btn_comfirm_sign_up.place(x=180, y=120)
btn_login = tk.Button(window, text='登录', command=usr_login)
btn_login.place(x=120, y=240)
btn_sign_up = tk.Button(window, text='注册', command=usr_sign_up)
btn_sign_up.place(x=200, y=240)
window.mainloop()2020-03-09T09:31:39 点赞:0