TypeError: 'Entry' object cannot be interpreted as an integer
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
from tkinter import ttk, simpledialog
import tkinter as tk
from tkinter import *
root = Tk()
root.resizable(0, 0)
root.title("Sorting and Searching Algorithm")
root.configure(bg='#ff8080')
root.geometry("750x550")
def arrays():
v = IntVar()
for widget in root.winfo_children():
widget.destroy()
def close():
for widget in root.winfo_children():
widget.destroy()
arrays()
titleFrame = Frame(root)
titleFrame.grid(row=0)
radioFrame = Frame(root)
radioFrame.grid(padx=350, pady=100)
inputFrame = tk.Frame(root, bg='#ff8080')
inputFrame.grid()
buttonFrame = Frame(root)
buttonFrame.grid()
Title = tk.Label(titleFrame, bg='#ff8080', text="Enter The Number of Elements In The Array", font="-weight bold")
Title.grid()
global NUMBER_OF_ENTRIES
NUMBER_OF_ENTRIES = Entry(inputFrame)
NUMBER_OF_ENTRIES.grid(row=0, column=1, sticky=E, ipadx=10, ipady=10,padx=10, pady=10)
if NUMBER_OF_ENTRIES == int:
print("Working")
else:
print("Please Enter a Integer Value")
global num
num = 0
#global NUMBER_OF_ENTRIES
#NUMBER_OF_ENTRIES = simpledialog.askinteger("Please Enter", "Enter The Number of Elements In The Array")
global alist
alist =
for i in range (0, NUMBER_OF_ENTRIES):
num = simpledialog.askinteger("Please Enter" ,"Enter The Entries In Array Element " + str(i))
alist = alist + [ num ]
calculate = ttk.Button(buttonFrame, text="Proceed", command=entries)
calculate.grid(row=4, column=0, sticky=E + S, ipadx=10, ipady=10)
arrays()
root.mainloop()
I am trying to make it so when a user inputs a integer number into the Entry input box it stores into the variable NUMBER_OF_ENTRIES. After it stores it, it then proceeds to use the value in the further conditionals.
But I am getting an issue when I try to compile it.
python tkinter
add a comment |
from tkinter import ttk, simpledialog
import tkinter as tk
from tkinter import *
root = Tk()
root.resizable(0, 0)
root.title("Sorting and Searching Algorithm")
root.configure(bg='#ff8080')
root.geometry("750x550")
def arrays():
v = IntVar()
for widget in root.winfo_children():
widget.destroy()
def close():
for widget in root.winfo_children():
widget.destroy()
arrays()
titleFrame = Frame(root)
titleFrame.grid(row=0)
radioFrame = Frame(root)
radioFrame.grid(padx=350, pady=100)
inputFrame = tk.Frame(root, bg='#ff8080')
inputFrame.grid()
buttonFrame = Frame(root)
buttonFrame.grid()
Title = tk.Label(titleFrame, bg='#ff8080', text="Enter The Number of Elements In The Array", font="-weight bold")
Title.grid()
global NUMBER_OF_ENTRIES
NUMBER_OF_ENTRIES = Entry(inputFrame)
NUMBER_OF_ENTRIES.grid(row=0, column=1, sticky=E, ipadx=10, ipady=10,padx=10, pady=10)
if NUMBER_OF_ENTRIES == int:
print("Working")
else:
print("Please Enter a Integer Value")
global num
num = 0
#global NUMBER_OF_ENTRIES
#NUMBER_OF_ENTRIES = simpledialog.askinteger("Please Enter", "Enter The Number of Elements In The Array")
global alist
alist =
for i in range (0, NUMBER_OF_ENTRIES):
num = simpledialog.askinteger("Please Enter" ,"Enter The Entries In Array Element " + str(i))
alist = alist + [ num ]
calculate = ttk.Button(buttonFrame, text="Proceed", command=entries)
calculate.grid(row=4, column=0, sticky=E + S, ipadx=10, ipady=10)
arrays()
root.mainloop()
I am trying to make it so when a user inputs a integer number into the Entry input box it stores into the variable NUMBER_OF_ENTRIES. After it stores it, it then proceeds to use the value in the further conditionals.
But I am getting an issue when I try to compile it.
python tkinter
add a comment |
from tkinter import ttk, simpledialog
import tkinter as tk
from tkinter import *
root = Tk()
root.resizable(0, 0)
root.title("Sorting and Searching Algorithm")
root.configure(bg='#ff8080')
root.geometry("750x550")
def arrays():
v = IntVar()
for widget in root.winfo_children():
widget.destroy()
def close():
for widget in root.winfo_children():
widget.destroy()
arrays()
titleFrame = Frame(root)
titleFrame.grid(row=0)
radioFrame = Frame(root)
radioFrame.grid(padx=350, pady=100)
inputFrame = tk.Frame(root, bg='#ff8080')
inputFrame.grid()
buttonFrame = Frame(root)
buttonFrame.grid()
Title = tk.Label(titleFrame, bg='#ff8080', text="Enter The Number of Elements In The Array", font="-weight bold")
Title.grid()
global NUMBER_OF_ENTRIES
NUMBER_OF_ENTRIES = Entry(inputFrame)
NUMBER_OF_ENTRIES.grid(row=0, column=1, sticky=E, ipadx=10, ipady=10,padx=10, pady=10)
if NUMBER_OF_ENTRIES == int:
print("Working")
else:
print("Please Enter a Integer Value")
global num
num = 0
#global NUMBER_OF_ENTRIES
#NUMBER_OF_ENTRIES = simpledialog.askinteger("Please Enter", "Enter The Number of Elements In The Array")
global alist
alist =
for i in range (0, NUMBER_OF_ENTRIES):
num = simpledialog.askinteger("Please Enter" ,"Enter The Entries In Array Element " + str(i))
alist = alist + [ num ]
calculate = ttk.Button(buttonFrame, text="Proceed", command=entries)
calculate.grid(row=4, column=0, sticky=E + S, ipadx=10, ipady=10)
arrays()
root.mainloop()
I am trying to make it so when a user inputs a integer number into the Entry input box it stores into the variable NUMBER_OF_ENTRIES. After it stores it, it then proceeds to use the value in the further conditionals.
But I am getting an issue when I try to compile it.
python tkinter
from tkinter import ttk, simpledialog
import tkinter as tk
from tkinter import *
root = Tk()
root.resizable(0, 0)
root.title("Sorting and Searching Algorithm")
root.configure(bg='#ff8080')
root.geometry("750x550")
def arrays():
v = IntVar()
for widget in root.winfo_children():
widget.destroy()
def close():
for widget in root.winfo_children():
widget.destroy()
arrays()
titleFrame = Frame(root)
titleFrame.grid(row=0)
radioFrame = Frame(root)
radioFrame.grid(padx=350, pady=100)
inputFrame = tk.Frame(root, bg='#ff8080')
inputFrame.grid()
buttonFrame = Frame(root)
buttonFrame.grid()
Title = tk.Label(titleFrame, bg='#ff8080', text="Enter The Number of Elements In The Array", font="-weight bold")
Title.grid()
global NUMBER_OF_ENTRIES
NUMBER_OF_ENTRIES = Entry(inputFrame)
NUMBER_OF_ENTRIES.grid(row=0, column=1, sticky=E, ipadx=10, ipady=10,padx=10, pady=10)
if NUMBER_OF_ENTRIES == int:
print("Working")
else:
print("Please Enter a Integer Value")
global num
num = 0
#global NUMBER_OF_ENTRIES
#NUMBER_OF_ENTRIES = simpledialog.askinteger("Please Enter", "Enter The Number of Elements In The Array")
global alist
alist =
for i in range (0, NUMBER_OF_ENTRIES):
num = simpledialog.askinteger("Please Enter" ,"Enter The Entries In Array Element " + str(i))
alist = alist + [ num ]
calculate = ttk.Button(buttonFrame, text="Proceed", command=entries)
calculate.grid(row=4, column=0, sticky=E + S, ipadx=10, ipady=10)
arrays()
root.mainloop()
I am trying to make it so when a user inputs a integer number into the Entry input box it stores into the variable NUMBER_OF_ENTRIES. After it stores it, it then proceeds to use the value in the further conditionals.
But I am getting an issue when I try to compile it.
python tkinter
python tkinter
edited Dec 18 '18 at 12:05
j_4321
6,21321631
6,21321631
asked Nov 17 '18 at 7:21
SŦAREXSŦAREX
11
11
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Because it's not an integer. NUMBER_OF_ENTRIES
is of type <class 'tkinter.Entry'>
.
The usual way to do this is to associate the entry with a StringVar()
which will reflect whatever is typed into the entry.
The text entered into an entry is still text so you'll have to convert it to int
explicitly.
See The Tkinter Entry Widget.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349130%2ftypeerror-entry-object-cannot-be-interpreted-as-an-integer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Because it's not an integer. NUMBER_OF_ENTRIES
is of type <class 'tkinter.Entry'>
.
The usual way to do this is to associate the entry with a StringVar()
which will reflect whatever is typed into the entry.
The text entered into an entry is still text so you'll have to convert it to int
explicitly.
See The Tkinter Entry Widget.
add a comment |
Because it's not an integer. NUMBER_OF_ENTRIES
is of type <class 'tkinter.Entry'>
.
The usual way to do this is to associate the entry with a StringVar()
which will reflect whatever is typed into the entry.
The text entered into an entry is still text so you'll have to convert it to int
explicitly.
See The Tkinter Entry Widget.
add a comment |
Because it's not an integer. NUMBER_OF_ENTRIES
is of type <class 'tkinter.Entry'>
.
The usual way to do this is to associate the entry with a StringVar()
which will reflect whatever is typed into the entry.
The text entered into an entry is still text so you'll have to convert it to int
explicitly.
See The Tkinter Entry Widget.
Because it's not an integer. NUMBER_OF_ENTRIES
is of type <class 'tkinter.Entry'>
.
The usual way to do this is to associate the entry with a StringVar()
which will reflect whatever is typed into the entry.
The text entered into an entry is still text so you'll have to convert it to int
explicitly.
See The Tkinter Entry Widget.
answered Nov 20 '18 at 5:54
figbeamfigbeam
3,4261311
3,4261311
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349130%2ftypeerror-entry-object-cannot-be-interpreted-as-an-integer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown