View Single Post
  #8  
Old 14th October 2020, 11:19 AM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

I solved this by creating a frame and spanning the column, i then just packed everything in from the left then just looped over and did it again.

Setting the colours definitely made a difference as i could see what was happening, now just to set them all back.

Code:
from tkinter import * from tkcalendar import Calendar,DateEntry import json import requests app = Tk() app.title("Todays Races") app.geometry("1000x500") app.configure(bg='Lightblue') app.resizable(width=False, height=False) #Clears Daily Race Meetings def Fclear(): for widget in Rinfo.winfo_children(): widget.destroy() #Collects Daily Race Meetings def get_json(): state = "VIC" date = cal.get() url = "https://api.beta.tab.com.au/v1/tab-info-service/racing/dates/" + str(date) + "/meetings?jurisdiction=" + state data = requests.get(url) data1 = json.loads(data.content) Venues = data1["meetings"] for V in Venues: Rtype = V["raceType"] Mname = V["meetingName"] Location = V["location"] Wcondition = V["weatherCondition"] Tcondition = V["trackCondition"] states = ("VIC","NSW","QLD","SA","WA","TAS","ACT") if Rtype == "R" and Location in states: #Race Info frame Rinfo = Frame(app, width=100, bg="green") Rinfo.grid(columnspan=1) #Race info Mname_label = Label(Rinfo, text=Mname, font=("bold", 12), width=20, anchor=W, bg="red") Mname_label.pack(side=LEFT) Location_label = Label(Rinfo, text=Location, font=("bold", 12), width=5 ,anchor=W, bg="red") Location_label.pack(side=LEFT) Tcondition_label = Label(Rinfo, text=Tcondition, font=("bold", 12), width=10 ,anchor=W, bg="red") Tcondition_label.pack(side=LEFT) Wcondition_label = Label(Rinfo, text=Wcondition, font=("bold", 12), width=10 ,anchor=W, bg="red") Wcondition_label.pack(side=LEFT) # Date Selection Frame Dateframe = Frame(app, bg="Lightblue") Dateframe.grid(row=0, column=0, sticky=W) #Frame widgets date_label = Label(Dateframe, text="Input Date", font=("bold", 14), bg="Lightblue") date_label.grid(row=0, column=0) cal = DateEntry(Dateframe,width=15, bg="darkblue", fg="white", date_pattern='yyyy-mm-dd',year=2020) cal.grid(row=0, column=2) date_btn = Button(Dateframe, text="Go", width=8, bg="Lightgreen", command=get_json) date_btn.grid(row=0, column=3) delete_btn = Button(Dateframe, text="Clear", width=8, bg="#ff704d", command=Fclear) delete_btn.grid(row=0, column=4) #Headings frame Headingsframe = Frame(app, bg="Lightblue") Headingsframe.grid(row=1, column=0, sticky=W) #Race Info Headings htrack = Label(Headingsframe, text="Track", pady=10, font=("bold", 12),anchor=W, width=20, fg="Blue", bg="yellow") htrack.grid(row=0, column=0) hstate = Label(Headingsframe, text="State", pady=10, font=("bold", 12),anchor=W, width=5, fg="Blue", bg="orange") hstate.grid(row=0, column=2) hcondition = Label(Headingsframe, text="Condition", pady=10, font=("bold", 12),anchor=W, width=10, fg="Blue", bg="blue") hcondition.grid(row=0, column=3) hweather = Label(Headingsframe, text="Weather", pady=10, font=("bold", 12),anchor=W, width=10, fg="Blue", bg="green") hweather.grid(row=0, column=4) app.mainloop()
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote