![]() |
[WxPython] make StaticText limit Number - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [WxPython] make StaticText limit Number (/thread-6520.html) |
make StaticText limit Number - royer14 - Nov-26-2017 I have an issue with StaticText, and I do not know how to make it accept only the following data = '0123456789.' . Of course, when you type any letter, the letter is automatically deleted. Can you help me please #add frame and other panel = wx.Panel(self) lci = wx.StaticText(panel, label='Ci', pos=wx.Point(280, 128),size=wx.Size(19, 23), style=0) lci.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD,False, 'Tekton Pro Ext')) inslci = wx.TextCtrl(panel, pos=wx.Point(312, 128), size=wx.Size(120, 24),style=0, value='...') inslci.SetForegroundColour(wx.Colour(64, 128, 128))how would it be possible to add a wx.adv.RichToolTip. I still do not have it very clear, could you explain? RE: make StaticText limit Number - Windspar - Nov-26-2017 You can use NumCtrl from wx.lib.masked. example import wx from wx.lib.masked import NumCtrl class Form: def __init__(self, *args, **kwargs): self.frame = wx.Frame(*args, **kwargs) self.panel = wx.Panel(self.frame) self.numctrl = NumCtrl(self.panel) if __name__ == '__main__': app = wx.App() hform = Form(None, title='Number Control') hform.frame.Show() app.MainLoop() RE: make StaticText limit Number - royer14 - Nov-26-2017 (Nov-26-2017, 08:38 PM)Windspar Wrote: You can use NumCtrl from wx.lib.masked.Okay, just if I want to place decimal numbers, how would I do? RE: make StaticText limit Number - Windspar - Nov-26-2017 wxpython Numctrl fractionWidth tell how many decimal places you want RE: make StaticText limit Number - royer14 - Nov-27-2017 (Nov-26-2017, 10:42 PM)Windspar Wrote: wxpython Numctrl exelent, thank you very much |