Python 3 guessing game - int() argument error
<p>This is the code in its full extent at the moment:</p>

<pre><code>import random
import time

from tkinter import *
from tkinter import ttk

mode_chosen = 0
def update_mode():
    global mode_chosen
    mode_chosen = entry.get()
    mode()

def mode():
    if mode_chosen == "1":
        new_player()
    if mode_chosen == "2":
        existing_player()
    if mode_chosen == "3":
        exit()

def new_player():
    global username
    entry_entry.pack_forget()
    entry1_entry.pack()
    choose_button.pack(side="bottom")

    screen_var.set("      Make a username or\ntype exit to leave the game")
    username = entry1.get()
    if username == "exit":
        exit()
    if username != "":
        screen_var.set("""Hello {}, here's how to play my game. I will think of a number between 1 and value depending on the difficulty you will choose, this will also decide how many tries you have to guess my number.""".format(username))  
        game()

def existing_player():
    global username
    entry_entry.pack_forget()
    entry1_entry.pack()
    choose_button.pack(side="bottom")

    screen_var.set("Please enter your username or type exit to leave the game") 
    username = entry1.get()
    if username == "exit":
        exit()
    if username != "":
        screen_var.set("\nWelcome back {}.".format(username))
        game()

def game():
    top = 0
    tries = 0
    screen_var.set("Pick a level of difficulty (e.g 1, 2, 3) or type exit to leave the game")
    entry1_entry.pack_forget()
    entry2_entry.pack()
    level = ""
    level = entry2.get() 

    if level == "1":
        top += 10
        tries = 2
        screen_var.set("\nWell I am thinking of a number between 1 and {}, you have {} tries to guess my number.\nType exit at anytime to leave the game.".format(top, tries + 1))
    elif level == "2":
        top += 20
        tries = 5
        screen_var.set("\nWell I am thinking of a number between 1 and {}, you have {} tries to guess my number.\nType exit at anytime to leave the game.".format(top, tries + 1))
    elif level == "3":
        top += 30
        tries = 8
        screen_var.set("\nWell I am thinking of a number between 1 and {}, you have {} tries to guess my number.\nType exit at anytime to leave the game.".format(top, tries + 1))
elif level == "exit":
    exit()

number = random.randint(1, top)
guesses_taken = 0
entry2_entry.pack_forget()
entry3_entry.pack()
guess = entry3.get
answer = int(guess)

while guesses_taken &lt;= tries:
    screen_var.set("Take a guess: ")
    guesses_taken += 1

    if answer &lt; 1:
        print("Guess a number between 1 and {}.".format(top))
        guess_taken -= 1
    if answer &gt; top:
        print("Guess a number between 1 and {}.".format(top))
        guess_taken -= 1
    if answer &lt; number:
        print("Your guess is too low")
    if answer &gt; number:
        print("Your guess is too high")
    if answer == number:
        break
    if guess == "exit":
        exit()


if answer == number:
    print("Good job, {}! You guessed my number in {} guesses!".format(username, guesses_taken))
if answer != number:
    print("Nope. The number I was thinking of was: {}.".format(number))

def exit():
    root.destroy()


root = Tk()
root.title("Guessing Game")


label1 = Label(root, text="Guessing Game")
label1.pack()

screen_var = StringVar()
screen_var.set("""Choose a mode by entering the number:
1: New Player
2: Existing Player
3: Exit
""")

screen_label = Label(root, textvariable=screen_var, justify="left")
screen_label.pack()

answer_label = ttk.Label(root, text="Answer: ")
answer_label.pack()

entry = StringVar()
entry_entry = ttk.Entry(root, textvariable=entry)
entry_entry.pack()

entry1 = StringVar()
entry1_entry = ttk.Entry(root, textvariable=entry1)

entry2 = StringVar()
entry2_entry = ttk.Entry(root, textvariable=entry2)

entry3 = StringVar()
entry3_entry = ttk.Entry(root, textvariable=entry3)

choose_button = ttk.Button(root, text="Choose", command=update_mode)
choose_button.pack()

root.mainloop()
</code></pre>

<p>At the moment I am running through moving the programme into a python gui, when it comes in this part:</p>

<pre><code>answer = int(guess)
</code></pre>

<p>It gives me the error message of:</p>

<pre><code>Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\lewis\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py", line 1550, in __call__
return self.func(*args)
  File "C:\Users\lewis\Desktop\GUI test\Gui_Game.py", line 11, in update_mode
mode()
  File "C:\Users\lewis\Desktop\GUI test\Gui_Game.py", line 15, in mode
new_player()
  File "C:\Users\lewis\Desktop\GUI test\Gui_Game.py", line 33, in new_player
game()
  File "C:\Users\lewis\Desktop\GUI test\Gui_Game.py", line 81, in game
answer = int(guess)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'method'
</code></pre>

<p>If anyone can help me find a solution to this error, it would be greatly apprieciated. Thanks. </p>

<p>Okay, so.</p>

<p>On line 77, you have</p>

<p><code>guess = entry3.get</code></p>

<p>entry3.get is a function. So instead it would be,</p>

<p><code>guess = entry3.get()</code></p>

<p>Sometimes you can use something like <code>print(type(entry3.get))</code> and it'll say</p>

<p><code>&lt;class 'method'&gt; &lt;bound method StringVar.get of &lt;tkinter.StringVar object at 0x034A6410&gt;&gt;</code></p>

<p>Which tells us it's a function and needs to have <code>()</code> after it.</p>

<p>Thanks,</p>

<p>~Coolq</p>

python