Jan-29-2022, 12:51 AM
Hi, i have been struggling with this for days looking at tutorial but just can't get it, i am creating an applications, my thought is to create app, then create frames for each section then add widgets to each section, i think i have the top section done but am trying to add 2 listboxes side by side, different widths on the left of the meetings_frame then i will be adding widgets to the right results_frame , but am stuck, any help please.
from tkinter import * app = Tk() app.title("Race Results") app.geometry("800x400") app.resizable(width=False, height=False) app.configure(bg="black") #create frames selection_frame = Frame(app, bg="black", width=800, height=50) meetings_frame = Frame(app, bg="black", width=150, height=350) mcode_frame = Frame(app, bg="black", width=50, height=350) results_frame = Frame(app, bg="black", width=600, height=350) #layout frames selection_frame.pack(side=TOP) meetings_frame.pack(side=LEFT) mcode_frame.pack(side=LEFT) results_frame.pack(side=RIGHT) #create selection widget venue_numberlabel = Label(selection_frame, bg="black", fg="white", text="Race No", font=("bold", 10), width=7) venue_numberbox = Entry(selection_frame, bg="#403F3F", fg="white", width=4) venues = Button(selection_frame, text="Result", bg="#403F3F", fg="white", width=8, command="") watch = Button(selection_frame, text="Watch Race", bg="#403F3F", fg="white", width=12, command="") listen = Button(selection_frame, text="Audio Only", bg="#403F3F", fg="white", width=12, command="") space = Label(selection_frame, bg="black", width=40) info = Label(selection_frame, bg="black", fg="white", text="Race Info", font=("bold", 10), width=7) #layout selection widgets venue_numberlabel.grid(row=0, column=0, padx=20, pady=5) venue_numberbox.grid(row=0, column=1, padx=20, pady=5) venues.grid(row=0, column=2, padx=20, pady=5) watch.grid(row=0, column=3, padx=20, pady=5) listen.grid(row=0, column=4, padx=20, pady=5) space.grid(row=0, column=5) info.grid(row=1, column=0, padx=20, pady=5) #create meeting list meetings = Listbox(meetings_frame, bg="black", fg="white", width=150, height=350) mcode = Listbox(meetings_frame, bg="black", fg="white", width=50, height=350) results = Label(meetings, bg="black", fg="white", text="Results", font=("bold", 10), width=600, height=350) #layout meeting list meetings.grid(row=0, column=0) mcode.grid(row=0, column=1) results.grid(row=0, column=0) meetings.insert(END, "Meetings") meetings.itemconfig(END, fg="orange") mcode.insert(END, "M-Code") mcode.itemconfig(END, fg="orange") app.mainloop()