Anki is probably the best program to memorize things. It has so many settings which help you to streamline the process of learning and also it supports wonderful add-ons which make life simpler. For example, AwesomeTTS allows you to change text into mp3 which you can play in your cards. I could write about advantages of Anki for hours. But it is not the subject of this post. Anki has one really big drawback. The GUI in desktop version (Android version which I'm using seems ok for me). It's ugly, looks old, all buttons are minuscule and hard to use with a touchscreen. Unfortunately, there are no add-ons which solve the problem entirely. But I found the way to make answer buttons to be more comfortable to use on a touchscreen so after that they look like this:
If you are interested how to do this. This article is for you. I will try to explain it to people who don't have experience with programming so buckle up.
DISCLAIMER:
This method worked on my Windows desktop version of Anki. It is not a professional solution! In fact, it is a very crude solution and it will only work properly with the English language. If you want it to work with other languages you will have to change some values. I'll show later in the article how to do that. There is also a chance that you will have to change some values regardless of using English to achieve the same result as me. Brute copy/paste of all the code below might not work. But if you copy/paste the code highlighted on the green it should work on all systems.
How to do this:
First, you need to install two add-ons from Anki-Web:
1. Bigger Show All Answer Buttons id: 2034935033
It makes buttons wider. And nothing more. I overwrote it to change the size of the buttons in all dimensions.
2. Button Colours (Good, Again) id: 2494384865
This add-on changes colors of a font in buttons. But I modified it to fill buttons with color.
To install add-ons in Anki open Tools/add-ons/Browse&Install and copy/paste aforementioned Id's:
Note that you can see all add-onsns installed in my Anki. If you want you can check them all.
3. Now you have to replace the code of aforementioned add-ons. First open Tools/add-ons/
Bigger_Show_All_Answer_Buttons/Edit:
Then just replace all the code with this bellow (in GEEN I marked lines changed by me from the original version. You can change only those lines wihout replacing the whole code!!!I highly recommend to do so) :
#################################################################################
import difflib, re, cgi
import unicodedata as ucd
import HTMLParser
from aqt.qt import *
from anki.utils import stripHTML, isMac, json
from anki.hooks import addHook, runHook
from anki.sound import playFromText, clearAudioQueue, play
from aqt.utils import mungeQA, getBase, openLink, tooltip
from aqt.sound import getAudio
import aqt
from aqt.reviewer import Reviewer
def myShowAnswerButton(self):
self._bottomReady = True
if not self.typeCorrect:
self.bottom.web.setFocus()
middle = '''
<span class=stattxt>%s</span><br>
<button title="%s" id=ansbut style="font-size : 20px; width:300px ; height:34px;" onclick='py.link(\"ans\");'>%s</button>''' % (
self._remaining(), _(""), _("Show Answer"))
# wrap it in a table so it has the same top margin as the ease buttons
middle = "<table cellpadding=0><tr><td class=stat2 align=center>%s</td></tr></table>" % middle
if self.card.shouldShowTimer():
maxTime = self.card.timeLimit() / 1000
else:
maxTime = 0
self.bottom.web.eval("showQuestion(%s,%d);" % (
json.dumps(middle), maxTime))
def myanswerButtons(self):
times = []
default = self._defaultEase()
def but(i, label):
if i == default:
extra = "id=defease"
else:
extra = ""
due = self._buttonTime(i)
return '''
<td align=center>%s<button %s title="%s" style="width:200px ; height:34px; padding: 0; border: none; background: none;" onclick='py.link("ease%d");'>\
%s</button></td>''' % (due, extra, _(""), i, label)
buf = "<center><table cellpading=0 cellspacing=0><tr>"
for ease, label in self._answerButtonList():
buf += but(ease, label)
buf += "</tr></table>"
script = """
<script>$(function () { $("#defease").focus(); });</script>"""
return buf + script
Reviewer._showAnswerButton = myShowAnswerButton
#################################################################################
Let's elaborate what I did especially in this line:
<td align=center>%s<button %s title="%s" style="width:200px ; height:34px; padding: 0; border: none; background: none;" onclick='py.link("ease%d");'>\
a. It changes with and the hight of all buttons: " style="width:200px ; height:34px;
b. It removes all settings of the buttons so the buttons are basically transparent: padding: 0; border: none; background: none;
4. Now you have to replace the code of the second add-on. Open Tools/add-ons/
Button_Colours_Good_Again/Edit
Then just replace all the code with this bellow (in GEEN I marked lines changed by me from the original version. You can change only those lines wihout replacing the whole code!!!I highly recommend to do so) :
#################################################################################
# Get reviewer classfrom aqt.reviewer import Reviewer
# Replace _answerButtonList method
def answerButtonList(self):
l = ((1, "<font size='6' color='white' style='background-color: red; padding: 10px 75px 10px 75px; outline: inherit' >" + _("Again") + "</font>"),)
cnt = self.mw.col.sched.answerButtons(self.card)
if cnt == 2:
return l + ((2, "<font size='6' color='white' style='background-color: green; padding: 10px 77px 10px 77px; outline: inherit'>" + _("Good") + "</font>"),)
elif cnt == 3:
return l + ((2, "<font size='6' color='white' style='background-color: green; padding: 10px 77px 10px 77px; outline: inherit'>" + _("Good") + "</font>"), (3, "<font size='6' color='white' style='background-color: blue; padding: 10px 81px 10px 81px; outline: inherit'>" + _("Easy")+"</font>"))
else:
return l + ((2,"<font size='6' color='white' style='background-color: orange; padding: 20px 79px 20px 79px; outline: inherit'>" + _("Hard") +"</font>"), (3, "<font size='6' color='white' style='background-color: green; padding: 10px 77px 10px 77px; outline: inherit'>" + _("Good") + "</font>"), (4, "<font size='6' color='white' style='background-color: blue; padding: 20px 81px 20px 81px; outline: inherit'>" +_("Easy") +"</font>"))
Reviewer._answerButtonList = answerButtonList
#################################################################################
l = ((1, "<font size='6' color='white' style='background-color: red; padding: 10px 75px 10px 75px; outline: inherit' >" + _("Again") + "</font>"),)
a. It sets font to size 6 and color of the font to white: font size='6' color='white'
b. It sets a color of the background of the button to red because this is the button "Again": background-color: red;
c. It fills the button with color. Note that this value is different in other buttons. And this will probably require form you to change it to be fitted to your version. (If the values are too small the buttons will be asymmetric and if too big the text inside will not be in the center.) : padding: 10px 75px 10px 75px;
And that is all. Congratulations. You have new beautiful buttons fitted to tablet mode. I hope this article was helpful for you. Just send a comment if you have any suggestions how to improve this article or just give me any other feedback.