猫史档案馆


333333

用户:东皇上东皇上查看:0 回复:1 评论:0 创建时间:2023-02-18T17:07:27


from tkinter import * root= Tk() root.title('英雄相册')
from PIL import Image from PIL import ImageTk #img = Image.open("1.jpg") img = ImageTk.PhotoImage(file='1.jpg') label = Label(root,width=980,height=500,image=img) label.grid(row=0,column=0,columnspan=0)




cur-img = 1 def callback_pre(): global cur_img_name current_img -= 1 if current_img ==0: current_img =6 img_new =Image.open(str(cur_img)+"jpg") img_new =Image.PhotoImage(img_new)
label = Label(root,width=980,height=500,image = img) label.grid(row=0,column=0,columnspan=2)

label.configure(image=img_new) label.image = image = img_new
def callback_next(): global current_img_name current_img += 1 if current_img == 7: current_img = 1 img_new = Image.open(str(current_img)+".jpg") img_new = Image.PhotoImage(img_new) label.configure(image=img_new) label.image = image = img_new

btn_pre = Button(root,text="上一张",font=("黑体",20)) btn_pre.grid(row=1,column=0) btn_next = Button(root, text="下一张", font=("黑体", 20)) btn_next.grid(row=1, column=1)

root.mainloop()


回复

上一页1 页 / 共 1下一页
无敌版滑稽战神无敌版滑稽战神

我的天哪!!!(((

点赞0


评论