91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3.19MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-02
  • 語言: Python
  • 標簽: python2.7??tkinter??

資源簡介

python大一時的期末大作業,老師要求用python2.7,只允許在tkinter的基礎上做一個小游戲,這是我在當時做的拼圖游戲,最后得了95分。下載之后覺得不錯的希望給個好評

資源截圖

代碼片段和文件信息

#?coding:?utf-8
import?Tkinter?as?tk
from?tkMessageBox?import?*
import?random

#選擇游戲難度
def?easyh():
????eout?=?0
????window0?=?tk.Tk()
????window0.title(“puzzling?game“)
????window0.geometry(“300x170“)
????v1?=?tk.IntVar()
????v1.set(3)
????tk.Label(window0?text=“請選擇你想進行的游戲難度“?font=(“consolas“?16)).pack()
????tk.Radiobutton(window0?text=“簡單“?variable=v1?value=3?font=(“consolas“?12)).pack()
????tk.Radiobutton(window0?text=“一般“?variable=v1?value=4?font=(“consolas“?12)).pack()
????tk.Radiobutton(window0?text=“困難“?variable=v1?value=5?font=(“consolas“?12)).pack()

????def?to_close():
????????window0.quit()
????????window0.destroy()

????tk.Button(window0?text=“開始游戲“?width=10?height=1?font=(“consolas“?14)?bg=‘green‘?command=to_close).pack()
????window0.mainloop()
????if?v1.get()?==?3:
????????eout?=?3
????if?v1.get()?==?4:
????????eout?=?4
????if?v1.get()?==?5:
????????eout?=?5
????return?eout

#主程序的類
class?game_window:
????def?__init__(self?lev):
????????self.lev?=?lev
????????self.clickflag?=?False
????????self.wbd?=?100
????????self.root?=?tk.Tk()
????????self.root.title(“puzzle?game“)
????????self.root.geometry(“600x720“)
????????canvas1?=?tk.Canvas(self.root?height=720?width=600)
????????bg_image_file?=?tk.PhotoImage(file=“great?snow.gif“)
????????image_of_bg?=?canvas1.create_image(0?0?anchor=“nw“?image=bg_image_file)
????????canvas1.pack(side=“top“)#背景圖片

????????self.fp?=?tk.frame(self.root?width=480?height=600?relief=“groove“)
????????self.fp.place(x=60?y=30)#游戲框架

????????image_file_arr?=?[“t1.gif“?“t2.gif“?“t3.gif“?“t4.gif“?“t5.gif“?“t6.gif“?“t7.gif“?“t8.gif“?“t9.gif“?“t10.gif“
??????????????????????????“t11.gif“?“t12.gif“?“t13.gif“?“t14.gif“?“t15.gif“?“t16.gif“?“t17.gif“?“t18.gif“?“t19.gif“
??????????????????????????“t20.gif“?“t21.gif“]
????????pr?=?random.randint(0?len(image_file_arr)?-?1)
????????self.image_file?=?image_file_arr[pr]
????????#預覽的函數
????????def?preview_pic():

????????????self.showimg?=?tk.Toplevel(self.root)
????????????self.showimg.title(“source?picture“)
????????????self.showimg.geometry(“500x620“)
????????????canvas_pre?=?tk.Canvas(self.showimg?width=500?height=620?bg=‘white‘)
????????????image_to_puzzle?=?tk.PhotoImage(file=self.image_file)
????????????can1?=?canvas_pre.create_image(10?10?image=image_to_puzzle?anchor=“nw“)
????????????canvas_pre.pack()
????????????self.showimg.mainloop()

????????#投降的函數
????????def?surrendit():
????????????answer?=?askokcancel(title=‘認輸‘?message=‘是否再玩一局?‘)
????????????if?answer:
????????????????self.root.quit()
????????????????self.root.destroy()
????????????????main()
????????????else:
????????????????self.root.quit()
????????????????self.root.destroy()

????????self.prebutton?=?tk.Button(self.root?width=10?height=1?bg=“green“?text=“預覽“?command=preview_pic)
????????self.prebutton.place(x=160?y=680)
????????self.surbutton?=?tk.Button(self.ro

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-12-29?13:17??workf\
?????文件???????81063??2017-12-13?10:50??workf\center.gif
?????文件????????8182??2017-12-29?13:17??workf\game_class.py
?????文件??????201137??2017-11-29?11:26??workf\great?snow.gif
?????文件??????118942??2017-11-29?14:09??workf\t1.gif
?????文件???????67001??2017-12-24?20:16??workf\t10.gif
?????文件??????150922??2017-12-24?22:36??workf\t11.gif
?????文件??????244349??2017-12-24?22:36??workf\t12.gif
?????文件??????176524??2017-12-29?12:50??workf\t13.gif
?????文件??????142032??2017-12-29?12:51??workf\t14.gif
?????文件??????132005??2017-12-29?12:52??workf\t15.gif
?????文件??????151214??2017-12-29?12:53??workf\t16.gif
?????文件??????171615??2017-12-29?12:56??workf\t17.gif
?????文件??????121019??2017-12-29?12:57??workf\t18.gif
?????文件??????167486??2017-12-29?13:00??workf\t19.gif
?????文件??????158312??2017-11-29?14:11??workf\t2.gif
?????文件??????104160??2017-12-29?13:01??workf\t20.gif
?????文件??????156520??2017-12-29?13:16??workf\t21.gif
?????文件??????156700??2017-11-29?14:16??workf\t3.gif
?????文件??????139452??2017-11-29?14:46??workf\t4.gif
?????文件???????90415??2017-12-24?19:31??workf\t5.gif
?????文件??????134676??2017-12-24?19:33??workf\t6.gif
?????文件??????113900??2017-12-24?19:37??workf\t7.gif
?????文件??????187180??2017-12-24?19:39??workf\t8.gif
?????文件??????188307??2017-12-24?19:41??workf\t9.gif

評論

共有 條評論