How to print/show an expression in rational number form in python
<p>I've been developing a Tkinter app and at some label i need to put formula that should look like a rational number(expression1/expression2, like a numerator and denominator and a bar between them). I did some digging and couldnt find anything related to it. Any suggestions on how this can be done ?</p>

<p>I even couldnt find anything on printing a fraction in a rational number format on the console. I oonly care about the looks and no calculation will be made with it, its just a label</p>

<p>A high-tech solution would be to use <a href="http://matplotlib.org/1.4.1/index.html" rel="nofollow">matplotlib</a> in Tkinter. It provides a scaled-down version of <code>Latex</code> which it calls <a href="http://matplotlib.org/1.4.1/users/mathtext.html#mathtext-tutorial" rel="nofollow">mathtext</a>. This route doesn't look easy but seems to be possible. See <a href="http://stackoverflow.com/q/22179244/4996248">this</a> question for details. If this way seems too involved, a similar but perhaps easier idea would be to use MathML (officially part of HTML5) for the markup. It might be easier to embed in Tkinter.</p>

<p>A comparatively low-tech approach would be to use two labels (with invisible borders) for the numerator and denominator respectively, with a thin rectangle between them. It will take some tweaking, but you should be able to adjust fonts and alignment so that the result looks like a single expression.</p>

python math tkinter