简体   繁体   中英

Is it possible to put a label on wxPython gizmos ledctrl?

I would like to put a label on wxPython gizmos led, like this.

在此处输入图像描述

But I can't find how to make a label on the led.

My code is like this. I used wxPython StaticText to make the led label, and adjusted the position.

import wx.lib.gizmos.ledctrl as led
import wx

class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, parent = None, title= "LED Test", size = (300,200))
        self.panel = wx.Panel(self)
        self.myLed = led.LEDNumberCtrl(self.panel, -1, size = (100, 30), pos = (100,50))
        self.label = wx.StaticText(self.panel, -1, "my LED" , pos=(130,57))
        self.myLed.SetBackgroundColour("green")
        self.label.SetBackgroundColour("green")


if __name__ == "__main__":
    app = wx.App()
    frame = MainFrame()
    frame.Show()
    app.MainLoop()

How can I make a gizmos led label?

In short, the answer is no, as the question is written.
It is limited to the characters that can be displayed.

The LEDNumberCtrl can be used to display a series of digits, (plus spaces, colons or dashes,) using a style reminiscent of old-timey segmented digital displays.

import wx.lib.gizmos.ledctrl as led
import wx

class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, parent = None, title= "LED Test", size = (300,200))
        self.panel = wx.Panel(self)
        self.myLed = led.LEDNumberCtrl(self.panel, -1, size = (200,50), pos = (50,50))
        self.myLed.SetValue(" 22:01")

if __name__ == "__main__":
    app = wx.App()
    frame = MainFrame()
    frame.Show()
    app.MainLoop()

在此处输入图像描述

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