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 get the integer value of a checkBox
Forum Update on Monday, May 27th 2025

How to get the integer value of a checkBox

Scheduled Pinned Locked Moved Solved Qt for Python
3 Posts 2 Posters 699 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.
  • L Offline
    L Offline
    LT-K101
    wrote on 4 Oct 2022, 10:48 last edited by LT-K101 10 Apr 2022, 11:11
    #1

    I want to get the int value when I check the checkBox, the result I get is a 0 instead of 1. Below is what I did please I need assistance.

    can_add = int(self.ui.manageemp_canAdd_checkBox.isChecked())
    print(can_add)
    
    J 1 Reply Last reply 4 Oct 2022, 11:00
    0
    • L LT-K101
      4 Oct 2022, 10:48

      I want to get the int value when I check the checkBox, the result I get is a 0 instead of 1. Below is what I did please I need assistance.

      can_add = int(self.ui.manageemp_canAdd_checkBox.isChecked())
      print(can_add)
      
      J Offline
      J Offline
      JonB
      wrote on 4 Oct 2022, 11:00 last edited by
      #2

      @LT-K101
      This code should be returning the correct value, so if it returns 0 that checkbox is not checked. Check where you are calling it from, and which checkbox it refers to.

      L 1 Reply Last reply 4 Oct 2022, 11:46
      1
      • J JonB
        4 Oct 2022, 11:00

        @LT-K101
        This code should be returning the correct value, so if it returns 0 that checkbox is not checked. Check where you are calling it from, and which checkbox it refers to.

        L Offline
        L Offline
        LT-K101
        wrote on 4 Oct 2022, 11:46 last edited by
        #3

        @JonB Thanks a lot I was calling it wrongly.

        1 Reply Last reply
        0

        1/3

        4 Oct 2022, 10:48

        • Login

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