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 make a curved QPushButton in PyQt5?
Qt 6.11 is out! See what's new in the release blog

How to make a curved QPushButton in PyQt5?

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 3.1k 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.
  • niklaspeter123N Offline
    niklaspeter123N Offline
    niklaspeter123
    wrote on last edited by
    #1
    This post is deleted!
    ndiasN 1 Reply Last reply
    0
    • niklaspeter123N niklaspeter123

      This post is deleted!

      ndiasN Offline
      ndiasN Offline
      ndias
      wrote on last edited by
      #2

      Hi @niklaspeter123 ,

      You can use Style Sheet to customize border-radius property (radius of the button's corners):

      # setting geometry of button
      button.setGeometry(200, 150, 100, 100)
        
      # setting radius and border - Circular button
      button.setStyleSheet("border-radius : 50; border : 2px solid black")
      
      # setting radius and border - Curved corners
      button.setStyleSheet("border-radius : 50; border : 2px solid black")
      
      1 Reply Last reply
      0
      • niklaspeter123N Offline
        niklaspeter123N Offline
        niklaspeter123
        wrote on last edited by
        #3

        If it is possible only the outer edge of the circle should be pressable.

        JonBJ 1 Reply Last reply
        0
        • niklaspeter123N niklaspeter123

          If it is possible only the outer edge of the circle should be pressable.

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

          @niklaspeter123
          I imagine for that you'll have to write code to do a hit-test of where the mouse is when the button is pressed.

          niklaspeter123N 1 Reply Last reply
          0
          • JonBJ JonB

            @niklaspeter123
            I imagine for that you'll have to write code to do a hit-test of where the mouse is when the button is pressed.

            niklaspeter123N Offline
            niklaspeter123N Offline
            niklaspeter123
            wrote on last edited by
            #5

            @JonB Is there no other method?

            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