Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How to create labels at run time

    Qt for Python
    3
    2
    1058
    Loading More Posts
    • 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.
    • T
      TejG last edited by

      Hello All,
      I have an array that gets populated based on the name of the processes at run time.For each process that is running I want to create a label and checkbox how can I do it using PyQT.I was able to do this in tkinter by using a for loop but dont know regarding Pyqt?

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @TejG last edited by

        @TejG

        for name in array_of_names:
            label = QLabel(name, self)
            checkbox = QCheckBox(name, self)
            # do something with these, like add them to your layout
            ...
        

        As @Denni-0 says, you might to create a "composite" QWidget which holds both the label & the checkbox, laid out as desired, rather than keeping them as separate widgets.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post