small graphical question

16 views
Skip to first unread message

Nathan smith

unread,
Feb 9, 2021, 8:46:51 PM2/9/21
to wxpytho...@googlegroups.com
Hi Folks,


So this question was originally asked over on the Tutor mailing list as
i was not *entirely* sure it was not just a case of me not knowing
certain symbols.


Apparently alas, it is not just a simple symbols issue.


I'm using a wx.textCtrl and trying to write powers and fractions. For
instance, I would like to write 3 superscript 2 for 3 squared, or 3 over
5 for fractions, without necessarily writing 3/5.


I did a look around and found a question related to this to do with a
multiline Rich Text Widget but I'm hoping to only work with a single
line textCtrl.


Any help is appreciated on which way to approach this issue.

V Best,

Nathan

Tim Roberts

unread,
Feb 9, 2021, 9:15:06 PM2/9/21
to wxpytho...@googlegroups.com
Nathan smith wrote:
>
> I'm using a wx.textCtrl and trying to write powers and fractions. For
> instance, I would like to write 3 superscript 2 for 3 squared, or 3
> over 5 for fractions, without necessarily writing 3/5.
>
> I did a look around and found a question related to this to do with a
> multiline Rich Text Widget but I'm hoping to only work with a single
> line textCtrl.

Not in the general case, no.  Unicode does have glyphs for superscript
and subscript 1 through 9, and fractions for 1/2, 1/3, 2/3, 1/4, 3/4,
1/8, 3/8, 5/8, and 7/8, but that's it.  If you're looking for general
case math symbols, then you absolutely need rich text.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.


Nathan smith

unread,
Feb 10, 2021, 8:08:21 PM2/10/21
to wxpytho...@googlegroups.com
Hi Tim.


Really appreciate your response here.

time to dust off my Rich text research and start again!


V best

Nathan

Chris Barker

unread,
Jul 3, 2021, 12:55:54 PM7/3/21
to wxpython-users
and I"m not sure how far you'll get with raw richtext either, if you need more than the simplest math.

I"d look at matplotlib -- it has a mini TeX implementation for math -- you could probably use it to make bitmaps of the Math, and render those inline with text in a RichTextControl.

Or, if this doesn't need to be dynamic, use TeX, or MPL, or a browser option (MAthML and MathJAX, or ...) for making images of the math.

-CHB


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/e1d7d455-cfca-6315-9355-0a7641cbe761%40gmail.com.


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
0 new messages