简体   繁体   中英

Non-editable text box updated in real time from a wxSlider in wxPython

I want to create a non-editable text box with no cursor in wxPython. I want it to get updated in real time depending on the values from the wxSlider.

The box will basically have a quadratic equation whose coefficients should change depending on the value of the slider.

For example , what I want is very similar to this functionality in LabView -

在此处输入图片说明

Whenever you change the coefficients in the Numerator and Denominator spin control (instead of spin control I will have a slider ) it automatically changes in the transfer function textbox.

So what I want to know is:

  1. How to create such a text box?
  2. How to display a fraction like one in the picture in the text box?
  3. How to update the coefficients of the equation in the text box in real time based on changes done by a slider ( or spin control as shown in figure)

UPDATE: You made it clear that you want to render a formula, sort of. If you only use the inverted quadratic equation you could hack together some "ASCII art". But you will probably want to have something to render math text. As your program involves plots also you may want to incorporate matplotlib. In that case you can use its functionality to render math text (it uses a subset of LaTeX syntax which is builtin without actually requiring TeX). Seethis example on the mpl site , especially the MathTextParser . And you would use a wx.StaticBitmap to display the math text.

What you are searching for should be the wx.StaticText . You would update it with SetLabel() (method common to ancestor wx.Control ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM