問題描述
我想問一下如何在 kivy
應用程序中顯示數學文本..?例如:如何在 LaTeX 中執行與 $ frac{1}{2} $
或 $ 2^{3} $
相同的操作(省略字體類型,只要它是數學可讀的).
I would like to ask on how to display a math-text in a kivy
app..? For example : How to do the same thing as $ frac{1}{2} $
or $ 2^{3} $
does in LaTeX (omitting the font type, as long as it is math-readable).
我知道在 matplotlib.pyplot
模塊中,我可以使用字符串:r'$ frac{1}{2} $'
或 r'$ 2^{3} $'
生成數學文本.但這不會在 kivy
中產生所需的結果:
I know that in matplotlib.pyplot
module, I can use string : r'$ frac{1}{2} $'
or r'$ 2^{3} $'
to produce a math-text. But this does not produce the desired result in kivy
:
Label(text = r'$frac{1}{2}$')
將重現 $frac{1}{2}$.
謝謝.
推薦答案
請看sympy 模塊,那么在你的標簽中你必須使用一個可以顯示數學文本的 font_name
Please Take a look at the sympy module, then in your label you must use a font_name
that can display math-text
但是如果你想使用 Latex 公式,那么你必須找到一個可以顯示你想要的公式的字體名稱
but If you want to use Latex formula then you have to find a font_name that can display those formula like you want
更新:否則,您可以在 png 中生成 Latex,然后將其集成到您的 kivy 應用中
Update: Otherwise you can generate your Latex in a png then integrate it in your kivy app
這篇關于如何在 Kivy Python 中顯示數學文本?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!