# Countdown to Events / Exams addon \[Official Thread\]

**URL:** <https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093>\
**Category:** Add-ons\
**Created:** [July 17, 2020, 10:45am UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093 "2020-07-17T10:45:58Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![arpitdhiman777](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@arpitdhiman777](https://forums.ankiweb.net/u/arpitdhiman777)\
**Post date:** [March 17, 2021, 3:19pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/21 "2021-03-17T15:19:19Z")

</div>

I also updated to Anki 2.1.42, still same problem occurs.

---

<div class="post-metadata">

**Author:** ![sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sam](https://forums.ankiweb.net/u/sam)\
**Post date:** [March 19, 2021, 7:03pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/22 "2021-03-19T19:03:38Z")

</div>

I’m not exactly sure why that is happening, hopefully @dae can answer / fix that. (I think this is the problem most users were having rather than the one I made a post about a few days ago, and it is extremely confusing as I cannot see a reason for it. see:  
[Error thread 1](https://forums.ankiweb.net/t/updating-add-ons-bad-problem/8092)  
[Error thread 2](https://www.reddit.com/r/Anki/comments/m8ew0e/anki_stuck_during_addon_update/)  
[Error thread 3](https://www.reddit.com/r/Anki/comments/lag4k0/constantly_getting_a_check_for_updates_for_add/)

However, as a tempory fix, you should be able to get around it by doing the following:

1. Navigate to tools-\>add-ons
2. Select the add-on and click ‘view files’
3. Navigate to user\_files/events.db
4. Copy / move file to a temporary location (e.g desktop)
5. Delete add-on and redownload the add-on (remember to restart Anki)
6. Navigate to user\_files once again and replace the new events.db file with the file copied / moved earlier.
7. Restart anki and it should be working

---

<div class="post-metadata">

**Author:** ![djagger](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/djagger/32/15325_2.png) [@djagger](https://forums.ankiweb.net/u/djagger)\
**Post date:** [April 2, 2021, 4:05am UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/23 "2021-04-02T04:05:31Z")

</div>

Hi there,

Going to preface by stating that i’m a noob at code:

I was looking at the code for this add-on, and I was wondering if it were possible to assign a color to a range of numbers? For example, if an exam is \<7 days away, those numbers would be assigned a color value (red), whereas an exam that was 7-14 days away would be assigned a different color value (blue), etc.

---

<div class="post-metadata">

**Author:** ![spoidmore](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@spoidmore](https://forums.ankiweb.net/u/spoidmore)\
**Post date:** [August 10, 2021, 10:30pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/24 "2021-08-10T22:30:12Z")

</div>

Hi there, is there any chance you can edit the code to make the add on appear below the review heatmap? I’ve tried to rearrange the order by re-uploading the add ons and i’m still not having any luck, thank you in advance!!

---

<div class="post-metadata">

**Author:** ![blingblingboy](https://avatars.discourse-cdn.com/v4/letter/b/45deac/32.png) [@blingblingboy](https://forums.ankiweb.net/u/blingblingboy)\
**Post date:** [August 12, 2021, 8:17am UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/25 "2021-08-12T08:17:02Z")

</div>

Hi, this add-on is cool. I just wanted to make some CSS tweaks and I did it except for one change.

![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/0/0b5b21b1113215ed2e2b91e1bb79a6022f2b6638.png)

See, I wanna change the colour and styling of the events.  
I figured out I should make changes in the `define` and `return` functions, but I don’t know how to do it. Can you please help?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/5/53358fbb0098296f5889e34cef1ad7bdd16b2782.png)

---

<div class="post-metadata">

**Author:** ![sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sam](https://forums.ankiweb.net/u/sam)\
**Post date:** [August 12, 2021, 8:06pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/26 "2021-08-12T20:06:53Z")

</div>

Hi,  
Easiest way would be to delete the `bold` function, and replace where the arrow is pointing with the code in the following image:

 ![Screenshot 2021-08-12 at 21.03.29](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/8/8c2e5a0ddeab40c73bb5bdc2064db187f408e208.png)

From there you can do the CSS styling however you want. Let me know if you need more help 🙂

---

<div class="post-metadata">

**Author:** ![sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sam](https://forums.ankiweb.net/u/sam)\
**Post date:** [August 12, 2021, 8:19pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/27 "2021-08-12T20:19:07Z")

</div>

Hi, unfortunately not sure how to do this.

Bumping this as hopefully someone else will know?

---

<div class="post-metadata">

**Author:** ![blingblingboy](https://avatars.discourse-cdn.com/v4/letter/b/45deac/32.png) [@blingblingboy](https://forums.ankiweb.net/u/blingblingboy)\
**Post date:** [August 13, 2021, 6:27am UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/28 "2021-08-13T06:27:11Z")

</div>

Hey, sorry for troubling you again.  
This is what I get. (sorry, I don’t know much coding stuff). I wanna color the days like this and add some formatting to the ‘days until exam’ part.

![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/5/540a48239c33f21f1eb28c913c1b5f33034c0334.png)

This is the code I used for the above picture

```auto
def days_between(d1, d2):
    d1 = datetime.strptime(d1, "%Y-%m-%d")
    d2 = datetime.strptime(d2, "%Y-%m-%d")
    return (d1 - d2).days

def bold(s):
    return "<b>" + s + "</b>"

def display(deck_browser, content):
    content.stats += """<br><link rel="stylesheet" type="text/css" href="{}/styles.css"/><h3 style="color: #d3ba49;display: inline-block;margin 0px 20px" >Upcoming events </h3>
    <div class="settings-btn" onclick='pycmd(\"add-new-event\");'><img src="{}/icons/settings.png"></div>""".format(
        base_url, base_url)
    sortType = config['sort']
    data = cursor.execute(
        '''SELECT * FROM events ORDER by date(date) %s''' % sortType).fetchall()
    today = date.today().strftime("%Y-%m-%d")

    for row in data:
        eventID = row[0]
        due = row[1]
        exam = row[2]
        daysLeft = days_between(due, today)
        if daysLeft < 0:
            deleteEvent(eventID)
        else:
            content.stats += """<br><b style="color:#d3ba49 ">" + str(daysLeft) + "</b>""" + " days until " + exam

```

---

<div class="post-metadata">

**Author:** ![sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sam](https://forums.ankiweb.net/u/sam)\
**Post date:** [August 13, 2021, 6:57pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/29 "2021-08-13T18:57:22Z")

</div>

Hey happy to help, so to get the first bit to work you need to change the last line of your code to this:

```auto
content.stats += """<br><b style="color:#d3ba49 ">"""+ str(daysLeft) + """</b> days until """ + exam

```

To style the ‘days until exam’ part this will work:

```auto
content.stats += """<br><b style="color:#d3ba49 ">"""+ str(daysLeft) + """</b><span style="white-space:nowrap;color:blue":> days until </span>""" + exam

```

---

<div class="post-metadata">

**Author:** ![blingblingboy](https://avatars.discourse-cdn.com/v4/letter/b/45deac/32.png) [@blingblingboy](https://forums.ankiweb.net/u/blingblingboy)\
**Post date:** [August 14, 2021, 8:45am UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/30 "2021-08-14T08:45:54Z")

</div>

Works fine now, thank you!

---

<div class="post-metadata">

**Author:** ![celaimee](https://avatars.discourse-cdn.com/v4/letter/c/97f17d/32.png) [@celaimee](https://forums.ankiweb.net/u/celaimee)\
**Post date:** [September 9, 2021, 6:20am UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/31 "2021-09-09T06:20:20Z")

</div>

Found this comment in your reviews and totally agree with the idea: “Although this works, something like countdowns should be pinned to the top, ideally top-right or top left! It serves little purpose when it is pinned to the bottom of the page. Please add functionality to pin countdown to the top of the page.”

Thank you!

---

<div class="post-metadata">

**Author:** ![gbrl.sc](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gbrl.sc](https://forums.ankiweb.net/u/gbrl.sc)\
**Post date:** [September 19, 2021, 8:48pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/32 "2021-09-19T20:48:10Z")

</div>

Hi @sam

I’ve been trying to append the `settings button` to the bottom of the reviewer, but had no success.  
This is what I have in mind:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/6/64d7cf0152267ba9dc60fe5a2df798d47a62827f.png)

The main reason for this customization is that, while reviewing my cards, I often have ideas about things that I have to study more, or find more information from other sources, or make cross-references between cards, etc., so it’d be great if I had the option to easily create reminders while reviewing my cards.  
As I said before, I’ve been trying to do it myself, however, as my Python skills are very introductory, I wasn’t able to succeed.  
So, could you, please, give directions on how I should modify the source code of the add-on so it displays the settings button both on the `deckbrowser` and on the `reviewer`?

---

<div class="post-metadata">

**Author:** ![gbrl.sc](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gbrl.sc](https://forums.ankiweb.net/u/gbrl.sc)\
**Post date:** [September 20, 2021, 4:45pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/33 "2021-09-20T16:45:24Z")

</div>

Or maybe a button in the toolbar (like Amboss’ addon does):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/3/352811770c97acf2c55ac16b52244c1ff8f3aa40.png)

I put it among the editor’s top buttons, but it returns an error message whenever I click on it.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/e/ed53f5867c6438bc44cfcd8b7f8dcc5b1d4f88bf.png)

> Error  
> An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.  
> If the issue only occurs when add-ons are enabled, please use the Tools\>Add-ons menu item to disable some add-ons and restart Anki, repeat until you discover the add-on that is causing the problem.  
> When you’ve discovered the add-on that is causing the problem, please report the issue on the [add-ons section](https://help.ankiweb.net/discussions/add-ons/) of our support site.  
> Debug info:  
> Anki 2.1.44 (b2b3275f) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2  
> Platform: Windows 10  
> Flags: frz=True ao=True sv=2  
> Add-ons, last update check: 2021-09-19 21:05:22  
> Caught exception:  
> Traceback (most recent call last):  
> File “aqt\webview.py”, line 36, in cmd  
> File “aqt\webview.py”, line 135, in \_onCmd  
> File “aqt\webview.py”, line 580, in \_onBridgeCmd  
> File “”, line 2, in onBridgeCmd  
> File “anki\hooks.py”, line 89, in decorator\_wrapper  
> File “anki\hooks.py”, line 86, in repl  
> File “C:\Users\Gabriel\AppData\Roaming\Anki2\addons21\1423933177\view.py”, line 22, in myLinkHandler  
> return \_old(self, url)  
> File “aqt\editor.py”, line 466, in onBridgeCmd  
> TypeError: **init** () takes 1 positional argument but 2 were given

Do you think these modifications are doable?

---

<div class="post-metadata">

**Author:** ![alex2pok](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@alex2pok](https://forums.ankiweb.net/u/alex2pok)\
**Post date:** [July 24, 2025, 6:45pm UTC](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/35 "2025-07-24T18:45:13Z")

</div>

I added the option to select a tag to the event and on the home screen it shows a bar with the retention for the event  
 ![Captura de tela de 2025-07-24 15-42-37](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/c/e/cefcf05492a7a6b72ebd434ac35b9f7a23769b4e.png)

[Previous page](https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093.md?page=1)
