关注分享主机优惠活动
国内外VPS云服务器

TKINTER的TTK.NOTEBOOK多页开关(TKINTER多接口开关)

摘要:使用允许您直接启用以Code Chine Style的多个页面切换。 请点击Microsoft Yahei。 请点击Microsoft Yahei。 p>

使用ttk.notebook

直接单击代码:

导入tkinter作为tkrom tkinter导入tkinter导入终端类应用程序:def __init __(self,master):self.notebook = ttk.notebook(master)self.frame1 = tk.fram e(master)self.frame.frame.frame.frame.frame.frame2 = tk.frame(master) selff.label = tk.label(self.frame1,text =“ python”,font =(“中文运行脚本”,12))self.label.grid.grid()self.enfry1 = tk.entry(self.frame1,宽度,宽度,宽度= 35)self.entry1.grid(row = 0,列= 1)self.bu1 = tk.button(self.frame1,text =“ command = self.bu1)sel f.bu1 .grid(row = 0,column,column = 2)self。gh = 8)self.list1.grid(row = 1,columnspan = 5)self.bu2 = tk.button(self.frame2,text =“ command = self.bu2)self.bu2.grid()self.list2 = = tk.listbox(self.frame2,font =(“ Microsoft Yahei”,12),宽度= 38,高度= 8)self.list2.grid(row = 1,columnspan = 5)se lf.notebook add(self.frame1 ,text =“ test1”)self.notebook.add(self.frame2,text =“ test2”)self.notebook.pack(padx = 10,pady = 5,fill =tk。tk。都self):self.list1.insert(end,self.enfry1.get()+“生命很短,拥有python”)self.list1.see(end)self.list1.update()d ef bu2(self): self.list2.insert(end,“ python让我更强壮!”)self.list2.see(end)self.list2.update()如果__ -name __ ==“ __ -main __” “ notebook_test”)#root.iconbitmap(“ fa.ico”)#root. geometry(“ 400x200+100”)#root.resizable(0,0)#do不正确打开窗口。

未经允许不得转载:主机频道 » TKINTER的TTK.NOTEBOOK多页开关(TKINTER多接口开关)

评论 抢沙发

评论前必须登录!