我在 wxpython 中制作了一个程序,它向用户显示问题和一个带有答案的单选框。问题和答案应该在数据库中,并且是使用一些数学(括号,平方根等)格式化的文本。您能否建议我应该为这样的文本使用什么小部件以及数据库可能是什么?谢谢。
1 回答
For database you can use any sql based DB e.g. mysql or sqllite but if you do not have much data why not just store it in text files or as python module itself.
Displaying math symbols part is tricky, you will need a control which can display MathML(http://en.wikipedia.org/wiki/MathML) , I don't think any wxPython widget can do that, some browsers display MathML, so you may embed browser inside wxpython but that is also tricky.
Another alternative is to use mathplotlib to draw math symbols e.g. see http://matplotlib.sourceforge.net/users/mathtext.html#mathtext-tutorial
but IMO simplest/best way would be to just convert mathml xml to a image file and display it in a image control inside your app. e.g. you can use http://sourceforge.net/projects/svgmath/ to convert mathml to svg, convert svg to png using http://librsvg.sourceforge.net/
or you can also try http://sourceforge.net/projects/jeuclid/
You will have to experiment to see what is easiest for you but i don't think there is any easy way.