LED Indicator?



  • I'm trying to make an indicator make a simple GUI with a LCD Display and some sort of indicator depending on the display's value. I'm very new to QTDesigner so is there any way this can be achieved? Many thanks!



  • I suppose you could use designer for this, or even use the pre-made LED digit indicator widget, but when I instructed another guy on the benefits of Qt I just created a custom widget with a custom paint method to draw the line segments, and made it respond to a SetValue(unsigned i) slot.

    try creating a custom widget and we'll help you with specific problems you might need help with. You need to make some effort though.



  • @Kent-Dorfman so I'm following this tutorial (maybe my problem is that this isn't the best one to use, you tell me I guess:) [https://doc.qt.io/archives/qq/qq26-pyqtdesigner.html](link url) and the first thing I did was take the code that was given and put it all together, the problem is is that this bit,

    class GeoLocationWidget(QtWidgets):
    
      __pyqtSignals__ = ("latitudeChanged(double)",
                         "longitudeChanged(double)")
    
    def __init__(self, parent):```
    
    returns this, 
    Traceback (most recent call last):
      File "G:/Internship/QT Widgets/qwidtest/test.py", line 2, in <module>
        class GeoLocationWidget(QtWidgets):
    TypeError: module.__init__() takes at most 2 arguments (3 given)
    
    Thanks for helping!


  • @KarazQ said in LED Indicator?:

    class GeoLocationWidget(QtWidgets):

    Never seen a widget class derived from QtWidgets. Seen plenty derived from QWidget though.


  • Qt Champions 2018

    @KarazQ said in LED Indicator?:

    take the code that was given

    Well, you should take a look at the code you copy/paste.
    As @Kent-Dorfman said you can't subclass a module (QtWidgets). Subclass QWidget.
    Also, the error message tells you what is wrong: you're passing to many parameters to init



  • I developed an LED widget called QLed which you can pip install from PyPi (pip install QLed) or browse the source here: https://github.com/jazzycamel/QLed.


 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.