用户:MC_PZB查看:0 回复:0 评论:0 创建时间:2022-08-25T12:48:57
【作品展示】

【作品介绍】
这是一个简单的游戏框架,基于tkinter,类似于pgzero
【作品源代码】
import tkinter as tk win = tk.Tk() title = 'easy-game\'s GUI' height = '800' width = '600' c = tk.Canvas(win,height=1080,width=1920) def clear(): global c c.delete("all") class Role: def __init__(self,img,x=0,y=0): global c self.x = x self.y = y self.img = img def draw(self): global c image = c.create_image(self.x,self.y,image=tk.PhotoImage(file=self.img)) def meet(self,ob): return (self.x,self.y) == (ob.x,ob.y) def go(): global title global height global width win.title(title) win.geometry(width + 'x' + height) try: win.after(1000,update) win.bind('',onMouseClick) win.bind('',onKeyClick) except: pass c.pack() win.mainloop()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn