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. Center Align in PyQt6 (python)
Qt 6.11 is out! See what's new in the release blog

Center Align in PyQt6 (python)

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 25.3k 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.
  • A Offline
    A Offline
    Amahmoud
    wrote on last edited by
    #1

    How to center Align label in PyQt6 (python). How to add margins (fillings) as well

    eyllanescE 1 Reply Last reply
    0
    • A Amahmoud

      How to center Align label in PyQt6 (python). How to add margins (fillings) as well

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @Amahmoud Docs:

      • https://doc.qt.io/qt-6/qlabel.html#alignment-prop
      • https://doc.qt.io/qt-6/qlabel.html#margin-prop

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Amahmoud
        wrote on last edited by
        #3

        I am using python. I have tried several ones. I dont think I understand well so check what i have tried

        self.label.setAlignment(AlignCenter)
        self.label.setAlignment(Qt.AlignCenter)
        self.txtbx1.setAlignment(QtCore.Qt.AlignCenter)

        eyllanescE 1 Reply Last reply
        0
        • A Amahmoud

          I am using python. I have tried several ones. I dont think I understand well so check what i have tried

          self.label.setAlignment(AlignCenter)
          self.label.setAlignment(Qt.AlignCenter)
          self.txtbx1.setAlignment(QtCore.Qt.AlignCenter)

          eyllanescE Offline
          eyllanescE Offline
          eyllanesc
          wrote on last edited by
          #4

          @Amahmoud said in Center Align in PyQt6 (python):

          AlignCenter

          PyQt6 is more demanding so you must point out the enumeration:

          from PyQt6.QtCore import Qt
          
          label.setAlignmentQt.AlignmentFlag.AlignCenter)
          

          If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

          B 1 Reply Last reply
          0
          • eyllanescE eyllanesc

            @Amahmoud said in Center Align in PyQt6 (python):

            AlignCenter

            PyQt6 is more demanding so you must point out the enumeration:

            from PyQt6.QtCore import Qt
            
            label.setAlignmentQt.AlignmentFlag.AlignCenter)
            
            B Offline
            B Offline
            BarnBuilder
            wrote on last edited by
            #5

            @eyllanesc

            The syntax in your reply is incorrect. It is missing an open parenthesis (

            label.setAlignment(Qt.AlignmentFlag.AlignCenter)
            
            1 Reply Last reply
            2

            • Login

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