Python Icalandar
tatal21820
Messages postés
37
Statut
Membre
-
jordane45 Messages postés 30651 Date d'inscription Statut Modérateur Dernière intervention -
jordane45 Messages postés 30651 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour à tous,
Je voudrais savoir comment afficher mes RDV dans l'ordre, là ils s'affichent du plus loin au plus près je voudrais le contraire.
d'avance merci
import io
import locale
import urllib.request
from datetime import timedelta, datetime
from time import strftime
from tkinter import *
from tkinter import Tk
from urllib.request import urlopen
import feedparser
import icalendar
import pytz
import recurring_ical_events
import requests
from PIL import ImageTk, Image
locale.setlocale(locale.LC_ALL, 'fr_FR')
dat2 = datetime.now(pytz.timezone("Europe/Paris"))
INTERVAL = 2000
master = Tk()
master.attributes('-fullscreen', True)
master.bind('<Escape>', lambda e: master.destroy())
master.config(background='black')
frm_agd3 = LabelFrame(master, text="Anniverssaire", font='helvetica 15', fg='WHITE', bg='black', bd="0", relief=GROOVE)
frm_agd3.place(x=20, y=620, width=500, height=200)
def task():
start_date = dat2.date()
end_date = start_date + timedelta(days=30)
URL = "https://calendar.google.com/calendar/ical/xxxxxxxxxxxx.com/private" \
"xxxxxxxxxxxxxxxxxx/basic.ics "
ical_string = urllib.request.urlopen(URL).read()
calendar = icalendar.Calendar.from_ical(ical_string)
events = recurring_ical_events.of(calendar).between(start_date, end_date)
for lbl in frm_agd3.winfo_children():
lbl.destroy()
for event in events:
start = event["DTSTART"].dt
non = event["SUMMARY"]
agd_anni = Label(frm_agd3, text=non + " " + start.strftime("%A %d %B"), font="Arial 16", fg="WHITE",
bg="black")
agd_anni.pack(ipadx=20, pady=10)
master.after(INTERVAL, task)
master.after(0, task)
master.mainloop()