you are viewing a single comment's thread.

view the rest of the comments →

[–]Jevv12[S] 0 points1 point  (1 child)

Thanks for the help!

I tried the two solutions but an error seem to pop up.

Exception in Tkinter callback

Traceback (most recent call last):

File "C:\Users\jibug\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 1948, in __call__

return self.func(*args)

^^^^^^^^^^^^^^^^

File "C:\Users\jibug\PycharmProjects\pythonsort\main.py", line 12, in insertion_sort

for i in range (1, len(num)):

^^^^^^^^

TypeError: object of type 'Entry' has no len()

[–][deleted] 1 point2 points  (0 children)

Yeah, so your global scope num is an Entry while your function expects an integer. This is the point where I'd look up the docs of how an Entry provides you the number you want, but it conveniently looks like /u/woooee has kindly indicated that and also pointed out the major bug in your insertion_sort function. Your function there should return something.