HI, this is my program so far. It's using Tkinter GUI for Python. I want it to be able to display a car image and its information on the main window once a user displays their preference in the blanks created under the button "settings" (which is a separate window). How do I make it do so? Can you give me an idea and provide an example of it being done? Thanks!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

HI, this is my program so far. It's using Tkinter GUI for Python. I want it to be able to display a car image and its information on the main window once a user displays their preference in the blanks created under the button "settings" (which is a separate window). How do I make it do so? Can you give me an idea and provide an example of it being done? Thanks!

# This will import all the widgets
# and modules which are available in
from tkinter import *
from tkinter import messagebox
  
  
class NewWindow(Toplevel):
  
def __init__(self, master = None):
  
super().__init__(master = master)
  
self.title("Settings")
self.geometry("500x500")
  
self.columnconfigure(0,weight=1)
#Creating settings entries
self.label1= Label(self,text="Car Make: ",\
font=("Arial", 14))
self.label1.grid(row=0, column=0)
  
self.entry1 = Entry(self,width="20", font=("Arial", 14))
self.entry1.grid(row=10,column=0)
  
self.label2= Label(self,text="Car Model: ",\
font=("Arial", 14))
self.label2.grid(padx=(0,10))
  
self.entry2= Entry(self,width="20", font=("Arial", 14))
self.entry2.grid()
  
self.label3= Label(self,text="Colour: ",\
font=("Arial", 14))
self.label3.grid(padx=(0,10))
  
self.entry3= Entry(self,width="20", font=("Arial", 14))
self.entry3.grid()
  
self.label4= Label(self,text="Distance (Km): ",\
font=("Arial", 14))
self.label4.grid(padx=(0,10))
  
w = Spinbox(self, from_=0, to=500)
w.grid()
  
self.button1 = Button(self, text="Search")
self.button1.grid()
  
self.button2 = Button(self, text="Quit", command=self.master.destroy)
self.button2.grid()
  
  
  
  
#Main Window
  
master = Tk()
master.geometry("500x500")
master.title("Airbnb Car Rentals")
master.columnconfigure(0,weight=1)

#making background image
canvas = Canvas(master, width = 1000, height = 1000)
canvas.pack(fill=BOTH, expand=1)
img = PhotoImage(file="car_background.png")
canvas.create_image(0,0, anchor=NW, image=img)
  
label = Label(canvas, text ="Search Car",fg= "brown", font=("Arial", 30))
label.pack(side="top")

# a button widget which will
# open a new window on button click
btn = Button(canvas, text ="Settings", font=("Arial", 20))

# Following line will bind click event
# On any click left / right button
# of mouse a new window will be opened
btn.bind("<Button>",
lambda e: NewWindow(master))
btn.pack(pady = 10)   


mainloop()

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Running Time of Application
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education