Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. LED Indicator?
Forum Updated to NodeBB v4.3 + New Features

LED Indicator?

Scheduled Pinned Locked Moved Unsolved Qt for Python
6 Posts 4 Posters 4.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KarazQ
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      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.

      I light my way forward with the fires of all the bridges I've burned behind me.

      K 1 Reply Last reply
      0
      • Kent-DorfmanK Kent-Dorfman

        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.

        K Offline
        K Offline
        KarazQ
        wrote on last edited by
        #3

        @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!
        jsulmJ 1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by
          #4

          @KarazQ said in LED Indicator?:

          class GeoLocationWidget(QtWidgets):

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

          I light my way forward with the fires of all the bridges I've burned behind me.

          1 Reply Last reply
          1
          • K KarazQ

            @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!
            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @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

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • jazzycamelJ Offline
              jazzycamelJ Offline
              jazzycamel
              wrote on last edited by
              #6

              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.

              For the avoidance of doubt:

              1. All my code samples (C++ or Python) are tested before posting
              2. As of 23/03/20, my Python code is formatted to PEP-8 standards using black from the PSF (https://github.com/psf/black)
              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved