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. Get value of a tuple with a list
Forum Updated to NodeBB v4.3 + New Features

Get value of a tuple with a list

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 1.0k 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 last edited by
    #1

    Hi,
    I have a tuple within a list and I'm trying to get the last value of the tuple which is at index 16. When i run Name = self.ui.label_574.setText(data[0][0]) works but when I run Age = self.ui.label_574.setText(data[0][16] I get this error message setText(self, str): argument 1 has unexpected type 'int'. Please any help on what I'm doing wrong.

    jsulmJ L 2 Replies Last reply
    0
    • L LT-K101

      Hi,
      I have a tuple within a list and I'm trying to get the last value of the tuple which is at index 16. When i run Name = self.ui.label_574.setText(data[0][0]) works but when I run Age = self.ui.label_574.setText(data[0][16] I get this error message setText(self, str): argument 1 has unexpected type 'int'. Please any help on what I'm doing wrong.

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @LT-K101 The error is actually self-explanatory: you are trying to set an int where string is expected. You need to convert int to QString.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      L 1 Reply Last reply
      2
      • L LT-K101

        Hi,
        I have a tuple within a list and I'm trying to get the last value of the tuple which is at index 16. When i run Name = self.ui.label_574.setText(data[0][0]) works but when I run Age = self.ui.label_574.setText(data[0][16] I get this error message setText(self, str): argument 1 has unexpected type 'int'. Please any help on what I'm doing wrong.

        L Offline
        L Offline
        LT-K101
        wrote on last edited by
        #3

        @LT-K101 I solved it by doing Age = self.ui.label_574.setText(str(data[0][16]))

        1 Reply Last reply
        0
        • jsulmJ jsulm

          @LT-K101 The error is actually self-explanatory: you are trying to set an int where string is expected. You need to convert int to QString.

          L Offline
          L Offline
          LT-K101
          wrote on last edited by
          #4

          @jsulm Thanks a lot

          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