Convert tuple to int in Python

Viewed 106818

I'm brand new at python, and didn't understand the other answers for this question. Why when I run my code, does int(weight[0]) not convert variable "weight" into a integer. Try your best to dumb it down because I'm really new and still don't quite understand most of it. Here is the relevant section of my code

weight = (lb.curselection())
    print ("clicked")
    int(weight[0])
    print (weight)
    print (type(weight))

and heres my code for this script

lb = Listbox(win, height=240)
lb.pack()
for i in range(60,300):
    lb.insert(END,(i))
def select(event):
    weight = (lb.curselection())
    print ("clicked")
    int(weight[0])
    print (weight)
    print (type(weight))
lb.bind("<Double-Button-1>", select)

Thanks

When I run the code, it comes up with TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple' and I want it instead to convert the "weight" variable into a integer, so I can use it for math operations.

Full Traceback:Traceback (most recent call last): File "C:\Users\Casey\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 1699, in __call__ return self.func(*args) File "C:/Users/Casey/AppData/Local/Programs/Python/Python36-32/s.py", line 11, in select int(weight) TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'

2 Answers
Related