python 经典老人言
import tkinter as tk
class FlipBook:
def __init__(self, master):
self.master = master
master.title("经 典 老 人 言")
self.pages = [
"经 典 老 人 言",
"求学无笨者,努力就成功",
"读 书 百 遍,其 义 自 见",
"好记性比不上烂笔头",
"不怕学问浅,就怕志气短",
"若得惊人艺,须下苦功夫",
"黑发不知勤学早,白首方悔读书迟",
"天 才 出 于 勤 奋",
"莫道君行早,更有早行人",
"书山有路勤为径,学海无涯苦作舟",
"笨 鸟 先 飞 早 入 林",
"结 束"
]
self.current_page = 0
strs = '\n'.join(self.pages[self.current_page])
print(strs)
self.label = tk.Label(master, text=strs, bg="red", fg="yellow", font=("黑体", 42))
self.label.pack(expand=True, fill='both')
master.bind("<Button-1>", self.flip_page)
def flip_page(self, event):
self.current_page = (self.current_page + 1) % len(self.pages)
strs = '\n'.join(self.pages[self.current_page])
self.label.config(text=strs)
if __name__ == "__main__":
root = tk.Tk()
root.geometry("540x960")
app = FlipBook(root)
root.mainloop()