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)
Forum Updated to NodeBB v4.3 + New Features

Center Align in PyQt6 (python)

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 20.7k 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 24 Sept 2021, 17:24 last edited by
    #1

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

    E 1 Reply Last reply 24 Sept 2021, 17:34
    0
    • A Amahmoud
      24 Sept 2021, 17:24

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

      E Offline
      E Offline
      eyllanesc
      wrote on 24 Sept 2021, 17:34 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 24 Sept 2021, 20:50 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)

        E 1 Reply Last reply 24 Sept 2021, 20:57
        0
        • A Amahmoud
          24 Sept 2021, 20:50

          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)

          E Offline
          E Offline
          eyllanesc
          wrote on 24 Sept 2021, 20:57 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 30 Mar 2022, 19:57
          0
          • E eyllanesc
            24 Sept 2021, 20:57

            @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 30 Mar 2022, 19:57 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
            1

            • Login

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