18 17
Contact Author Sign in to rate

Multiple Choice [UPDATED AS OF 2.1.29]

<10kB. Updated 2020-09-04. Only supports Anki 2.1.x.
The author has shared 1 other item(s).

Description

UPDATED VERSION OF https://ankiweb.net/shared/info/379383283 to work with the new render options Not compatible with mobile versions, unfortunately :( If you have any questions, please post to https://forums.ankiweb.net/t/multiple-choice/1668 and I will do my best to help you. Removed the option to select multiple correct answers due to update to how cards are rendered. Will add in future update. This plugin lets you add multiple choice cards to Anki. These choices will be randomized. How to use: 1) Make a note with the following fields: MC_Ans, MC_1, MC_2, MC_3, ... (can have as may MC_#s). [ANKI 2.1 UPDATE: MC_Ans, MC_1, MC_2, etc. are configurable.but must retain the numbers. MC_Ans is changeable, and you can change the prefix for MC_1, MC_2, etc. For example, if you change it to Option then your fields must be Option1, Option2, etc. ] MC_Answer should have which MC_# has the right answer. For example, if MC_2 is the right answer, then MC_Answer should have 2. The right answer is Bangalore, which is in MC_1, so MC_Ans is 1. Only the fields starting with MC are essential. You can add as many other MC_# fields as you wish. 2) Make a card with {{MC_Questions:}} [ANKI 2.1 UPDATE: Also configurable] where you want the questions to appear, and {{MC_Answer:}} [ANKI 2.1 UPDATE: Also configurable] where you want the answer to appear. NOTE: YOU MUST HAVE THE COLON (':') AT THE END OF THE TWO FIELDS Note that you do not have to have any of the MC_# fields. Also, note that the answer choices are randomized - they will always be randomized. 3) The end. If you want to change the format of the correct answer, edit the file. How this works, in case you're interested: It uses filters to replace {{MC_Questions:}} with a shuffled list of the multiple choice options. Then, when it renders the answer, it looks at that list, finds the answer, and then replaces the answer with the SAME list, but the answer highlighted.

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

413154037

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1621739112
Use https://ankiweb.net/shared/info/1566095810 instead!!!
on 1616240237
i've used this for a while and it's actually good. but can you randomise multiple (2 or more options in one box 'Q_1', for example).
Question: Find the answer
Q_1
answer A
Q_2
answer B
Q_3
answer C or answer D or (answer D or answer C)
Q_n...
on 1616151708
Formating
on 1612950305
Works for me without problems until now (versions > 2.1.13)
For older 2.1.x versions try the
Add-on Multiple Choice (for Anki 2.1) (download-code 843236755)
PS: Make sure you use the correctly spelled !MC_x! field names.
Also make sure your are using the correctly spelled "fields"
on the card: !{{MC_Questions:}}! and !{{MC_Answer:}}!
on 1610500180
Other users: Make sure to make a test card and follow the instructions given on the page before you dive in. The set up isn't painful, but it's true the add-on doesn't work straight out of the box.

To the author: Very well done!
on 1609471635
Got the error:

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, repeating 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-on support site.
Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2020-12-31 13:38:30
Add-ons possibly involved: ⁨Multiple Choice UPDATED AS OF 2129⁩

Caught exception:
Traceback (most recent call last):
File "aqt/webview.py", line 37, in cmd
File "aqt/webview.py", line 123, in _onCmd
File "aqt/webview.py", line 547, in _onBridgeCmd
File "aqt/overview.py", line 67, in _linkHandler
File "aqt/main.py", line 661, in moveToState
File "aqt/main.py", line 683, in _reviewState
File "aqt/reviewer.py", line 65, in show
File "aqt/reviewer.py", line 118, in nextCard
File "aqt/reviewer.py", line 183, in _showQuestion
File "anki/cards.py", line 113, in question
File "anki/cards.py", line 133, in render_output
File "anki/template.py", line 217, in render
File "anki/template.py", line 302, in apply_custom_filters
File "anki/hooks.py", line 267, in __call__
File "/Users/user1/Library/Application Support/Anki2/addons21/413154037/multiple_choice.py", line 69, in mc_filter
return invalid_name(filter_name)
NameError: name 'invalid_name' is not defined
on 1605801177
Works like a charm, thanks. Randomized positions of the answers would be nice.
on 1602658095
Does an amazing job! Thanks :)
on 1602102462
Can someone share their card type via google drive for the people that don't understand all the steps?
on 1598384739
Amazing. Thanks very much. Works exactly as it should.
on 1597753414
Works perfectly if you follow the instructions exactly as stated. I see many negative reviewers did not read every word of the instructions and consequently ran into issues.
on 1597035801
I followed all instructions, but the field I designated as the correct answer is not the answer that shows up. Please fix this or addon is literally unusable and I just wasted 6 hours making 500 cards. Jesus christ
on 1596452692
I'm a bit confused because the backside of the card stated that "The answer must be in a field labeled MC_(total number of MCs + 2)". For example, I when I create a note with 3 choices, if I want the backside to show the correct answer, I have to rename the field with correct answer "MC_5". Whatever number I put in the field MC_Ans doesn't change the outcome.

But still, it worked.
on 1595982157
I am running Anki on Linux Mint your latest version latest version, I do not assume I am running the stable version I know I am not
Version 2.1.26 (70784154)
Python 3.8.1 Qt 5.14.1 PyQt 5.14.1

I am getting on startup this message after installing successfully. Message reads:

An add-on you installed failed to load. If problems persist, please go to the Tools>Add-ons menu, and disable or delete the add-on.

When loading '⁨Multiple Choice UPDATED AS OF 2114⁩':
⁨Traceback (most recent call last):
File "aqt/addons.py", line 211, in loadAddons
File "/home/derek/.local/share/Anki2/addons21/413154037/__init__.py", line 1, in <module>
from . import multiple_choice
File "/home/derek/.local/share/Anki2/addons21/413154037/multiple_choice.py", line 27, in <module>
oldRenderQA = _Collection._renderQA
AttributeError: type object '_Collection' has no attribute '_renderQA'

However It still appears to function I would also note I deleted the previous working version with this one.

Please do not take this a criticism I am quite pleased how the addon functions, I am not a programmer so could be showing my ignorance but following the adage the best part is no part. I wonder the following:

You are using Boolean lets call them flags to determine which of the answers are true or false with that in mind I am left to wonder why you need to specify before hand single choice, multiple choice and no choice when its already defined in the Boolean code "0 1 0 0 0". Again not a programmer just an observation.



29th July Updated

It Does not work after all the fields are completely different to that of the original. I created a new profile in Anki I also upgraded to latest Version 2.1.29 (bbff62bf)
Python 3.8.1 Qt 5.15.0 PyQt 5.15.0

I can only think I am missing some python code or library Multiple Choice on Linux does not work despite me saying earlier it does apologise to all for misleading everyone.
on 1592782511
Multiple Choice [Updated as of 2.1.14] Does not work
Win 10 Pro, Anki 2.1.26 on desktop machine
Followed instructions explicitly. Created note type multiple choice exactly as shown. Viewed cards and conformed exactly to the example.
Then installed this add-on. Received successful installation message. Closed Anki.
On restarting, Anki reports the add on you installed did not load. Err line 27 in multiple_choice.py, AttributeError:type object '_Collection' has no attribute '_renderQA'
on 1591683678
Doesn't work for 2.1.26
on 1589879627
Sadly it stopped working for Version 2.1.26 :(
Otherwise it was great. Maybe you could update again, it would be much appreciated :)
on 1589407551
I can create the cards but sometimes it will just mark random answers as right or wrong although in the note they are marked the opposite... Thats very unfortunate because I have to go into the note to see if my answer was actually right or wrong. I hope that tehre will be a good update because I really need this feature...
on 1588449114
I have been back and forth on this add-on. I've gone through the instructions with a fine tooth comb, making sure that what I have on my notes and cards are an exact match and I still get
"Front template has a problem:
Found '⁨{{MC_Questions}}⁩', but there is no field called '⁨MC_Questions⁩'
More information"
on 1587558394
Works perfectly. Follow the instructions
on 1586766083
Simple add-on, but not being able to use it on mobile platforms is a major hurdle.
Hope this gets fixed soon!
on 1584078481
Doesn't work
on 1582704071
It doesn’t work :(
on 1582286152
With the versiion
Version 2.1.20 (47a1bf8b)
Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
I get the following message on start up:
An add-on you installed failed to load. If problems persist, please go to the Tools>Add-ons menu, and disable or delete the add-on.
---------------------------
Anki
---------------------------
When loading 'Multiple Choice UPDATED AS OF 2114':
Traceback (most recent call last):
File "aqt\addons.py", line 205, in loadAddons
File "C:\Users\mengesh\AppData\Roaming\Anki2\addons21\413154037\__init__.py", line 1, in <module>
from . import multiple_choice
File "C:\Users\mengesh\AppData\Roaming\Anki2\addons21\413154037\multiple_choice.py", line 27, in <module>
oldRenderQA = _Collection._renderQA
AttributeError: type object '_Collection' has no attribute '_renderQA'
on 1580760240
no idea how to use it
on 1579347925
Fehler
Es ist ein Fehler aufgetreten. Bitte starten Sie Anki neu und halten Sie während des Startvorgangs die Umschalttaste gedrückt, damit Anki die installierten Erweiterungen temporär deaktiviert.
Wenn das Problem nur auftritt, wenn die Erweiterungen aktiviert sind, dann benutzen Sie bitte den Menueintrag Extras>Erweiterungen um die problembehaftete Erweiterung durch selektives Deaktivieren herauszufinden.
Wenn Sie die entsprechende Erweiterung herausgefunden haben, dann bitten wir Sie sich mit einem entsprechenden Problembericht an den Add-on-Bereich unserer Support-Webseite zu wenden, damit der Fehler behoben werden kann.
Debuginformationen:
Anki 2.1.19 (3c8690ae) Python 3.8.1 Qt 5.12.6 PyQt 5.12.3
Platform: Windows 10
Flags: frz=True ao=True sv=1

Caught exception:
Traceback (most recent call last):
File "aqt\progress.py", line 73, in handler
File "aqt\clayout.py", line 337, in _renderPreview
File "lib\site-packages\anki\cards.py", line 146, in q
File "lib\site-packages\anki\cards.py", line 163, in _getQA
File "C:\Users\Thomas\AppData\Roaming\Anki2\addons21\413154037\multiple_choice.py", line 53, in _renderQA
data[6] += "\x1f"
TypeError: 'tuple' object does not support item assignment
on 1578935889
Anki 2.1.17 (f4fb7319) Python 3.8.0 Qt 5.14.0 PyQt 5.13.2
Platform: Windows 10
Flags: frz=True ao=True sv=1

Caught exception:
Traceback (most recent call last):
File "aqt\progress.py", line 73, in handler
File "aqt\clayout.py", line 337, in _renderPreview
File "lib\site-packages\anki\cards.py", line 146, in q
File "lib\site-packages\anki\cards.py", line 163, in _getQA
File "C:\Users\user01\AppData\Roaming\Anki2\addons21\413154037\multiple_choice.py", line 53, in _renderQA
data[6] += "\x1f"
TypeError: 'tuple' object does not support item assignment
on 1578935703
Anki 2.1.17

Anki 2.1.17 (c69ccb50) Python 3.8.0 Qt 5.14.0 PyQt 5.13.2
Platform: Windows 10
Flags: frz=True ao=True sv=2

Caught exception:
Traceback (most recent call last):
File "aqt\browser.py", line 1542, in onTogglePreview
File "<D:\Anki\Anki.2.1.17\decorator.pyc:decorator-gen-38>", line 2, in _openPreview
File "lib\site-packages\anki\hooks.py", line 82, in decorator_wrapper
File "lib\site-packages\anki\hooks.py", line 73, in repl
File "aqt\browser.py", line 1593, in _openPreview
File "aqt\browser.py", line 1666, in _renderPreview
File "aqt\browser.py", line 1697, in _renderScheduledPreview
File "lib\site-packages\anki\cards.py", line 146, in q
File "lib\site-packages\anki\cards.py", line 163, in _getQA
File "D:\Anki\Anki.2.1.data\addons21\413154037\multiple_choice.py", line 53, in _renderQA
data[6] += "\x1f"
TypeError: 'tuple' object does not support item assignment
on 1578742393
Anki 2.1.17 (f4fb7319) Python 3.8.0 Qt 5.14.0 PyQt 5.13.2
Platform: Windows 10
Flags: frz=True ao=True sv=1

Caught exception:
Traceback (most recent call last):
File "aqt\progress.py", line 73, in handler
File "aqt\clayout.py", line 337, in _renderPreview
File "lib\site-packages\anki\cards.py", line 146, in q
File "lib\site-packages\anki\cards.py", line 163, in _getQA
File "C:\Users\Luca\AppData\Roaming\Anki2\addons21\413154037\multiple_choice.py", line 53, in _renderQA
data[6] += "\x1f"
TypeError: 'tuple' object does not support item assignment
on 1576960692
it works
on 1573912967
Very Good!

It would be even better if it can highlight multiple answers.
on 1565721625
Will it ever support the mobile version?
on 1565476115
Did not work for my Anki 2.1, even when I removed every addon that I had besides this, did not work when I updated to 2.1.14, so I switched to Anki 2.0 and tired the 2.0 version of this addon, that works well but please fix this issue, I very much prefer Anki 2.1!!!
on 1563599065
WONDERFUL. Thank you soo much! Works like a charm. :)
on 1561920764
Thank you very much :)

You can kinda get it on mobile. I wrote something and it works fine. You need to put this on the Front-Template (in the card styling options of you MC Template):
<br>
<br>
<script>
function showhide() {
if (document.getElementById('testdiv') .style.display=='none')
{var divsToHide = document.getElementsByClassName('showhide');
for(var i = 0; i < divsToHide.length; i++){
divsToHide[i] .style.display=''}}
else
{var divsToHide = document.getElementsByClassName('showhide');
for(var i = 0; i < divsToHide.length; i++){
divsToHide[i] .style.display='none'}}
}

document.onkeydown = function(evt) {
evt = evt || window.event;
if (evt.keyCode == 113) {
showhide();}
};
</script>

<button class="button" type="button" onclick="
showhide();">
Anzeigen
</button>

<div id="testdiv" class="showhide" style="display:none">
(1) {{MC_1}}
</div>

<div class="showhide" style="display:none">
(2) {{MC_2}}
</div>

<div class="showhide" style="display:none">
(3) {{MC_3}}
</div>


<div class="showhide" style="display:none">
(4) {{MC_4}}
</div>


And this on Back Template:
<br>
<br>
<script>
function showhide() {
if (document.getElementById('testdiv') .style.display=='none')
{var divsToHide = document.getElementsByClassName('showhide');
for(var i = 0; i < divsToHide.length; i++){
divsToHide[i] .style.display=''}}
else
{var divsToHide = document.getElementsByClassName('showhide');
for(var i = 0; i < divsToHide.length; i++){
divsToHide[i] .style.display='none'}}
}

document.onkeydown = function(evt) {
evt = evt || window.event;
if (evt.keyCode == 113) {
showhide();}
};
</script>

<button class="button" type="button" onclick="
showhide();">
Anzeigen
</button>

<div id="testdiv" class="showhide" style="display:none">
(1) {{MC_1}}
</div>

<div class="showhide" style="display:none">
(2) {{MC_2}}
</div>

<div class="showhide" style="display:none">
(3) {{MC_3}}
</div>


<div class="showhide" style="display:none">
(4) {{MC_4}}
</div>

<div class="showhide" style="display:none">
<br>
Answer: <div class=antwort> {{MC_Ans}}
</div>
</div>





You can also add this in the styling option - to make the answer pop out more:

.antwort {
font-size: 21px;
color: red;
}