Add comments to the code

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Add comments to the code

import tkinter as tk

from PIL import ImageTk,Image

 

w = Tk()

w.title("North American Countries ")

w.configure(bg='#49A')

w.geometry('600x300')

 

f1 = LabelFrame(w, text="", width=100, highlightbackground='blue')

f1.grid(row=0, column=0, padx=20, pady=10, ipadx=20, ipady=10)

 

 

 

def fun1():

    label1 = Label(w, text=" Ottawa ", padx=100, relief=RAISED)

    label1.grid(row=2, column=1)

    label2.configure(image=img1)

 

 

def fun2():

    label1 = Label(w, text=" Washington, D.C ", padx=70, relief=RAISED)

    label1.grid(row=2, column=1)

    label2.configure(image=img2)

 

 

 

def fun3():

    label1 = Label(w, text=" Mexico City ", padx=70, relief=RAISED)

    label1.grid(row=2, column=1)

    label2.configure(image=img3)

 

 

def fun4():

    label1 = Label(w, text="", padx=70, relief=RAISED)

    label1.grid(row=2, column=1)

 

 

label1 = Label(w, text="", padx=100, relief=RAISED)

label1.grid(row=2, column=1)

 

label2 = Label(w, text="", padx=100, relief=RAISED)

label2.grid(row=0, column=1)

 

 

imgurl1 = "/Users/Ali Computers/Desktop/canada.jpeg"

imgurl2 = "/Users/Ali Computers/Desktop/usa.jpeg"

imgurl3 = "/Users/Ali Computers/Desktop/mexico.jpeg"

 

img1 = ImageTk.PhotoImage(Image.open(imgurl1))

img2 = ImageTk.PhotoImage(Image.open(imgurl2))

img3 = ImageTk.PhotoImage(Image.open(imgurl3))

 

 

 

 

ca = Button(f1, text=" Canada ", width=20, command=fun1)

ca.grid(row=1, column=1)

 

us = Button(f1, text=" U.S.A ", width=20, command=fun2)

us.grid(row=2, column=1)

 

me = Button(f1, text=" Mexico ", width=20, command=fun3)

me.grid(row=3, column=1)

 

td = Button(w, text="Restore", width=20, command=fun4)

td.grid(row=5, column=1)

e = Button(w, text="Exit", command=exit, width=20)

e.grid(row=6, column=1)

 

w.mainloop()

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY