IPY widgets not functioning in Jupyter Book #1214
Unanswered
Phys-Prof-Nielsen
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a code that I am using for a quiz. It utilizes ipywidgets for user input. The code works as intended in jupyter notebook, however, when rendered using JupyterBook the widgets gives no response.
I tried a simpler approch simpy using "input" function but that was not working either as I got an error message saying that frontend does not support input requests.
Any suggestions are appreciated. Thank you!
I have attached code below:
import random
import ipywidgets as widgets
from IPython.display import display, clear_output
Katakana character-to-Romanized dictionary
katakana_dict = {
'ア': 'あ', 'イ': 'い', 'ウ': 'う', 'エ': 'え', 'オ': 'お',
'カ': 'か', 'キ': 'き', 'ク': 'く', 'ケ': 'け', 'コ': 'こ',
'サ': 'さ', 'シ': 'し', 'ス': 'す', 'セ': 'せ', 'ソ': 'そ',
'タ': 'た', 'チ': 'ち', 'ツ': 'つ', 'テ': 'て', 'ト': 'と',
'ナ': 'な', 'ニ': 'に', 'ヌ': 'ぬ', 'ネ': 'ね', 'ノ': 'の',
'ハ': 'は', 'ヒ': 'ひ', 'フ': 'ふ', 'ヘ': 'へ', 'ホ': 'ほ',
'マ': 'ま', 'ミ': 'み', 'ム': 'む', 'メ': 'め', 'モ': 'も',
'ヤ': 'や', 'ユ': 'ゆ', 'ヨ': 'よ',
'ラ': 'ら', 'リ': 'り', 'ル': 'る', 'レ': 'れ', 'ロ': 'ろ',
'ワ': 'わ', 'ヲ': 'を', 'ン': 'ん'
}
Function to generate a new question when the button is clicked
def next_question(b):
generate_question()
Function to generate a random quiz question
def generate_question():
# Clear previous output
clear_output(wait=True)
Generate the first question
generate_question()
Beta Was this translation helpful? Give feedback.
All reactions