Question: This is my last program for the semester and I am stuck. Here is my code (Python 3, 64-bit): from tkinter import * master =
This is my last program for the semester and I am stuck. Here is my code (Python 3, 64-bit):
from tkinter import * master = Tk() listbox = Listbox(exportselection=0) listbox.pack() listbox.insert(END, "Person") for item in ["Bruce Wayne", "Clark Kent", "Peter Parker", "Rick Blaine", "Willie Wonka"]: listbox.insert(END, item) listbox2 = Listbox(exportselection=0) listbox2.pack() listbox2.insert(END, "Workplace") for item in ["Wayne Enterprises", "Daily Planet", "Daily Bugle", "Rick's American Cafe", "Chocolate Factory"]: listbox2.insert(END, item) master.mainloop()
I removed my comments to make the code easier to read. The problem is, I need the list boxes on right/left, versus top/bottom. And the menu items, "Person" and "Workplace", they appear to be part of the list. I am at a loss.
I used exportselection=0 because it is required. The program will also need to project a "right" or "wrong" when the correct/wrong items are selected.
Here are the program requirements that must be met:
| Person (List title) | Workplace (List title) |
| Bruce Wayne | Wayne Enterprises |
| Clark Kent | Daily Planet |
| Peter Parker | Daily Bugle |
| Rick Blaine | Rick's American Cafe |
| Willie Wonka | Chocolate Factory |
Using this table, write a program that displays the people in list box 1, workplace in list box 2, having each box list the person/place in alphabetical order. The user will attempt to match a person to their workplace by making a selection from each list (this is where I used exportselection=0). Once they do, there will be a button they will press to show "correct" or "incorrect" that will tell them whether or not they made a correct match. Good luck! The button I am confident I can do, but my pseudocode and my program are a little mismatched, so I think my logic is off on the whole for matching the values. As you can see, I have made some headway, but I need assistance figuring out the logic and where to go next. Any help on this would be greatly appreciated. Rooted in faith, rpg
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
