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. How to create labels at run time

How to create labels at run time

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 3 Posters 1.5k Views
  • 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 Offline
    T Offline
    TejG
    wrote on last edited by
    #1

    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?

    JonBJ 1 Reply Last reply
    0
    • T TejG

      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?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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
      0

      • Login

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