Community
how to add image in Tkinter in python
by: ankit1063, 7 years ago
class SeaofBTCapp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
container = tk.Frame(self)
container.pack(side="top", fill="both", expand = True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (StartPage,Pcb1,Pcb2,PageOne1,PageOne11,PageOne12,PageOne13,PageTwo2,PageTwo11,PageTwo12,PageTwo13,PageThree3,PageThree11,PageThree12,PageThree13,Pagea,Pageb,Pagec,Paged,Pagee,Pagef,Pageg,Pageh,Pagei,Pagej,Pagek,Pagel,Pagem,Pagen,Pageo,Pagep,Pageq,Pager,Pages,Paget,Pageu,Pagev,Pagew,Pagex,Pagey,Pagez,Pagey_z,H5,H12,B5,B12,F5,F12):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame(StartPage)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
class StartPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self,parent)
label = tk.Label(self, text="Siddaganga Institute of Technology, Tumkur", font=LARGE_FONT3)
label.pack()
label1 = tk.Label(self, text=" Dept. of Telecommunication Engg.", font=LARGE_FONT4)
label1.pack(pady=10,padx=10)
label1 = tk.Label(self, text=" Virtual LAB ", font=LARGE_FONT4)
label1.pack(pady=10,padx=10)
label1 = tk.Label(self, text=" For", font=LARGE_FONT4)
label1.pack(pady=10,padx=10)
label1 = tk.Label(self, text=" Analog Electronic Circuits Experiments", font=LARGE_FONT4)
label1.pack(pady=10,padx=10)
button1 = tk.Button(self, font=LARGE_FONT, text="Click for Experiments on Rectifier Circuits and Line and Load Regulation",
command=lambda: controller.show_frame(Pcb1))
button1.pack(pady=20,padx=20)
#button2 = tk.Button(self, font=LARGE_FONT, text=" PCB2 ",
# command=lambda: controller.show_frame(Pcb2))
# button2.pack(pady=20,padx=20)
button13 = tk.Button(self, font=LARGE_FONT2, text="click for reset",
command=led_on28)
button13.pack()
class Pcb1(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
label = tk.Label(self, text="Siddaganga Institute of Technology", font=LARGE_FONT4)
label.pack()
label1 = tk.Label(self, text=" Virtual LAB", font=LARGE_FONT4)
label1.pack(pady=10,padx=10)
button1 = tk.Button(self, font=LARGE_FONT, text="Half Wave Rectifier and Regulator ",
command=lambda: controller.show_frame(PageOne1))
button1.pack(pady=20,padx=20)
button2 = tk.Button(self, font=LARGE_FONT, text="Full Wave Rectifier and Regulator",
command=lambda: controller.show_frame(PageTwo2))
button2.pack(pady=20,padx=20)
button4 = tk.Button(self, font=LARGE_FONT, text="Bridge Rectifier and Regulator ",
command=lambda: controller.show_frame(PageThree3))
button4.pack(pady=20,padx=20)