是否可以在wxPython gizmos ledctrl上放置标签?

问题描述 投票:1回答:1

我想像这样在wxPython gizmos led上贴标签。

enter image description here

但是我找不到如何在led上做标签。

我的代码是这样的。我使用wxPython StaticText制作了led标签,并调整了位置。

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()

如何制作Gizmos LED标签?

python wxpython
1个回答
0
投票

简而言之,答案是“否”,因为问题已写成。仅限于可以显示的字符。

LEDNumberCtrl可以用于显示一系列数字(加上空格,冒号或破折号),其使用方式类似于旧式分段数字显示器。

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()

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.