'<=' not supported between instances of 'int' and 'method'

Question:

enter image description here
enter image description here

>! How to fix this error? I wanted to make this application in such a way that when you enter into Text_Field = Entry (root, textvariable = txt), e.g. the number 20, a 20-character password is generat

‘<=’ not supported between instances of ‘int’ and ‘method’


Asked By: kulikod

||

Answers:

You have a typo in the first line of buttonFunction(), it should be Pole_tekstowe.get(). The Parentheses are important

Answered By: KillerRebooted

It is because L2 is just the reference to the function Pole_tekstowe.get, you need to use Pole_tekstowe.get() to get the input text and use int() to convert it to integer in order to pass it as the second argument of random.sample():

L2 = int(Pole_tekstowe.get())
Answered By: acw1668