Python: Costing calculator output
Good day all
I'm busy creating a small costing calculator for the signage department.
I'm not getting the calculator to output the amount.
Brief Description:
You enter the height and width and then when you hit enter it needs to display the cost.
How do I get it to work? Any suggestions please and thanks.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
return cost
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
#call function
#squeare()
window.mainloop()
python python-3.x tkinter
add a comment |
Good day all
I'm busy creating a small costing calculator for the signage department.
I'm not getting the calculator to output the amount.
Brief Description:
You enter the height and width and then when you hit enter it needs to display the cost.
How do I get it to work? Any suggestions please and thanks.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
return cost
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
#call function
#squeare()
window.mainloop()
python python-3.x tkinter
2
Could you add the specific problem you are running into and perhaps an error message. This is very broad at the moment
– Sven Harris
Nov 22 '18 at 12:32
@SvenHarris it's running so I can add the height & width but upon hitting enter nothing happens.
– Louis Botha
Nov 22 '18 at 12:44
add a comment |
Good day all
I'm busy creating a small costing calculator for the signage department.
I'm not getting the calculator to output the amount.
Brief Description:
You enter the height and width and then when you hit enter it needs to display the cost.
How do I get it to work? Any suggestions please and thanks.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
return cost
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
#call function
#squeare()
window.mainloop()
python python-3.x tkinter
Good day all
I'm busy creating a small costing calculator for the signage department.
I'm not getting the calculator to output the amount.
Brief Description:
You enter the height and width and then when you hit enter it needs to display the cost.
How do I get it to work? Any suggestions please and thanks.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
return cost
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
#call function
#squeare()
window.mainloop()
python python-3.x tkinter
python python-3.x tkinter
asked Nov 22 '18 at 12:26
Louis BothaLouis Botha
164
164
2
Could you add the specific problem you are running into and perhaps an error message. This is very broad at the moment
– Sven Harris
Nov 22 '18 at 12:32
@SvenHarris it's running so I can add the height & width but upon hitting enter nothing happens.
– Louis Botha
Nov 22 '18 at 12:44
add a comment |
2
Could you add the specific problem you are running into and perhaps an error message. This is very broad at the moment
– Sven Harris
Nov 22 '18 at 12:32
@SvenHarris it's running so I can add the height & width but upon hitting enter nothing happens.
– Louis Botha
Nov 22 '18 at 12:44
2
2
Could you add the specific problem you are running into and perhaps an error message. This is very broad at the moment
– Sven Harris
Nov 22 '18 at 12:32
Could you add the specific problem you are running into and perhaps an error message. This is very broad at the moment
– Sven Harris
Nov 22 '18 at 12:32
@SvenHarris it's running so I can add the height & width but upon hitting enter nothing happens.
– Louis Botha
Nov 22 '18 at 12:44
@SvenHarris it's running so I can add the height & width but upon hitting enter nothing happens.
– Louis Botha
Nov 22 '18 at 12:44
add a comment |
2 Answers
2
active
oldest
votes
I have bound the window frame with the return key. There is an empty result label. Whenever you press the enter key, its text will be updated.
from tkinter import *
from tkinter import ttk
def squeare(height, width):
cost = float(height) * float(width)/1000000 * 650 * 1.15 * 1.50
result.configure(text=str(cost))
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky="nsew")
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
height.set(0)
width = StringVar()
width.set(0)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=0, row=0, sticky="we")
ttk.Label(mainframe, text="X").grid(column=1, row=0, sticky="e")
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=2, row=0, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=3, row=0, sticky="e")
result = ttk.Label(mainframe)
result.grid(row=0, column=4)
window.bind('<Return>', lambda e: squeare(height.get(), width.get()))
window.mainloop()
Thank all of you I will review my code and see where I was in the wrong. I appreciate the very quick assistance from all
– Louis Botha
Nov 22 '18 at 12:56
@LouisBotha Sure. Just edited my code to take care of the default values as well.
– Miraj50
Nov 22 '18 at 12:57
add a comment |
The is to catch the 'enter' event for the second input field.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
result.configure(text=str(cost))
def enter(event=None):
squeare(height.get(), width.get())
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
width_entry.bind('<Return>',enter)
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
result = ttk.Label(mainframe, text="")
result.grid(column=9, row=1, sticky=E)
window.mainloop()
This thing doesn't even work!
– Germa Vinsmoke
Nov 22 '18 at 12:49
@Uwe Ziegenhagen it works just displaying the result in on the GUIs window, not in it.
– Louis Botha
Nov 22 '18 at 12:52
Place a result label east to the "=" label and use theconfigure
method of the label. I updated my code
– Uwe Ziegenhagen
Nov 22 '18 at 13:09
@GermaVinsmoke: Works fine here...
– Uwe Ziegenhagen
Nov 22 '18 at 13:10
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%2f53430996%2fpython-costing-calculator-output%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have bound the window frame with the return key. There is an empty result label. Whenever you press the enter key, its text will be updated.
from tkinter import *
from tkinter import ttk
def squeare(height, width):
cost = float(height) * float(width)/1000000 * 650 * 1.15 * 1.50
result.configure(text=str(cost))
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky="nsew")
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
height.set(0)
width = StringVar()
width.set(0)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=0, row=0, sticky="we")
ttk.Label(mainframe, text="X").grid(column=1, row=0, sticky="e")
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=2, row=0, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=3, row=0, sticky="e")
result = ttk.Label(mainframe)
result.grid(row=0, column=4)
window.bind('<Return>', lambda e: squeare(height.get(), width.get()))
window.mainloop()
Thank all of you I will review my code and see where I was in the wrong. I appreciate the very quick assistance from all
– Louis Botha
Nov 22 '18 at 12:56
@LouisBotha Sure. Just edited my code to take care of the default values as well.
– Miraj50
Nov 22 '18 at 12:57
add a comment |
I have bound the window frame with the return key. There is an empty result label. Whenever you press the enter key, its text will be updated.
from tkinter import *
from tkinter import ttk
def squeare(height, width):
cost = float(height) * float(width)/1000000 * 650 * 1.15 * 1.50
result.configure(text=str(cost))
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky="nsew")
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
height.set(0)
width = StringVar()
width.set(0)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=0, row=0, sticky="we")
ttk.Label(mainframe, text="X").grid(column=1, row=0, sticky="e")
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=2, row=0, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=3, row=0, sticky="e")
result = ttk.Label(mainframe)
result.grid(row=0, column=4)
window.bind('<Return>', lambda e: squeare(height.get(), width.get()))
window.mainloop()
Thank all of you I will review my code and see where I was in the wrong. I appreciate the very quick assistance from all
– Louis Botha
Nov 22 '18 at 12:56
@LouisBotha Sure. Just edited my code to take care of the default values as well.
– Miraj50
Nov 22 '18 at 12:57
add a comment |
I have bound the window frame with the return key. There is an empty result label. Whenever you press the enter key, its text will be updated.
from tkinter import *
from tkinter import ttk
def squeare(height, width):
cost = float(height) * float(width)/1000000 * 650 * 1.15 * 1.50
result.configure(text=str(cost))
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky="nsew")
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
height.set(0)
width = StringVar()
width.set(0)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=0, row=0, sticky="we")
ttk.Label(mainframe, text="X").grid(column=1, row=0, sticky="e")
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=2, row=0, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=3, row=0, sticky="e")
result = ttk.Label(mainframe)
result.grid(row=0, column=4)
window.bind('<Return>', lambda e: squeare(height.get(), width.get()))
window.mainloop()
I have bound the window frame with the return key. There is an empty result label. Whenever you press the enter key, its text will be updated.
from tkinter import *
from tkinter import ttk
def squeare(height, width):
cost = float(height) * float(width)/1000000 * 650 * 1.15 * 1.50
result.configure(text=str(cost))
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky="nsew")
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
height.set(0)
width = StringVar()
width.set(0)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=0, row=0, sticky="we")
ttk.Label(mainframe, text="X").grid(column=1, row=0, sticky="e")
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=2, row=0, sticky=(W,E))
ttk.Label(mainframe, text="=").grid(column=3, row=0, sticky="e")
result = ttk.Label(mainframe)
result.grid(row=0, column=4)
window.bind('<Return>', lambda e: squeare(height.get(), width.get()))
window.mainloop()
edited Nov 22 '18 at 12:56
answered Nov 22 '18 at 12:48
Miraj50Miraj50
2,7801924
2,7801924
Thank all of you I will review my code and see where I was in the wrong. I appreciate the very quick assistance from all
– Louis Botha
Nov 22 '18 at 12:56
@LouisBotha Sure. Just edited my code to take care of the default values as well.
– Miraj50
Nov 22 '18 at 12:57
add a comment |
Thank all of you I will review my code and see where I was in the wrong. I appreciate the very quick assistance from all
– Louis Botha
Nov 22 '18 at 12:56
@LouisBotha Sure. Just edited my code to take care of the default values as well.
– Miraj50
Nov 22 '18 at 12:57
Thank all of you I will review my code and see where I was in the wrong. I appreciate the very quick assistance from all
– Louis Botha
Nov 22 '18 at 12:56
Thank all of you I will review my code and see where I was in the wrong. I appreciate the very quick assistance from all
– Louis Botha
Nov 22 '18 at 12:56
@LouisBotha Sure. Just edited my code to take care of the default values as well.
– Miraj50
Nov 22 '18 at 12:57
@LouisBotha Sure. Just edited my code to take care of the default values as well.
– Miraj50
Nov 22 '18 at 12:57
add a comment |
The is to catch the 'enter' event for the second input field.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
result.configure(text=str(cost))
def enter(event=None):
squeare(height.get(), width.get())
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
width_entry.bind('<Return>',enter)
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
result = ttk.Label(mainframe, text="")
result.grid(column=9, row=1, sticky=E)
window.mainloop()
This thing doesn't even work!
– Germa Vinsmoke
Nov 22 '18 at 12:49
@Uwe Ziegenhagen it works just displaying the result in on the GUIs window, not in it.
– Louis Botha
Nov 22 '18 at 12:52
Place a result label east to the "=" label and use theconfigure
method of the label. I updated my code
– Uwe Ziegenhagen
Nov 22 '18 at 13:09
@GermaVinsmoke: Works fine here...
– Uwe Ziegenhagen
Nov 22 '18 at 13:10
add a comment |
The is to catch the 'enter' event for the second input field.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
result.configure(text=str(cost))
def enter(event=None):
squeare(height.get(), width.get())
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
width_entry.bind('<Return>',enter)
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
result = ttk.Label(mainframe, text="")
result.grid(column=9, row=1, sticky=E)
window.mainloop()
This thing doesn't even work!
– Germa Vinsmoke
Nov 22 '18 at 12:49
@Uwe Ziegenhagen it works just displaying the result in on the GUIs window, not in it.
– Louis Botha
Nov 22 '18 at 12:52
Place a result label east to the "=" label and use theconfigure
method of the label. I updated my code
– Uwe Ziegenhagen
Nov 22 '18 at 13:09
@GermaVinsmoke: Works fine here...
– Uwe Ziegenhagen
Nov 22 '18 at 13:10
add a comment |
The is to catch the 'enter' event for the second input field.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
result.configure(text=str(cost))
def enter(event=None):
squeare(height.get(), width.get())
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
width_entry.bind('<Return>',enter)
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
result = ttk.Label(mainframe, text="")
result.grid(column=9, row=1, sticky=E)
window.mainloop()
The is to catch the 'enter' event for the second input field.
from tkinter import *
from tkinter import ttk
#Define the Functions here
def squeare(height,width):
cost = ((float(height) * float(width))/1000000 * 650 * 1.15 * 1.50)
result.configure(text=str(cost))
def enter(event=None):
squeare(height.get(), width.get())
window = Tk()
window.title("Costing Calculator V1.0")
mainframe = ttk.Frame(window, padding="20 20 20 20")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
height = StringVar()
width = StringVar()
#ttk.Label(mainframe, text="H").grid(column=1, row=1, sticky=E)
height_entry = ttk.Entry(mainframe, width=7, textvariable=height)
height_entry.grid(column=3, row=1, sticky=(W,E))
ttk.Label(mainframe, text="X").grid(column=5, row=1, sticky=E)
#ttk.Label(mainframe, text="W").grid(column=6, row=1, sticky=E)
width_entry = ttk.Entry(mainframe, width=7, textvariable=width)
width_entry.grid(column=7, row=1, sticky=(W,E))
width_entry.bind('<Return>',enter)
ttk.Label(mainframe, text="=").grid(column=8, row=1, sticky=E)
result = ttk.Label(mainframe, text="")
result.grid(column=9, row=1, sticky=E)
window.mainloop()
edited Nov 22 '18 at 13:09
answered Nov 22 '18 at 12:46
Uwe ZiegenhagenUwe Ziegenhagen
33521128
33521128
This thing doesn't even work!
– Germa Vinsmoke
Nov 22 '18 at 12:49
@Uwe Ziegenhagen it works just displaying the result in on the GUIs window, not in it.
– Louis Botha
Nov 22 '18 at 12:52
Place a result label east to the "=" label and use theconfigure
method of the label. I updated my code
– Uwe Ziegenhagen
Nov 22 '18 at 13:09
@GermaVinsmoke: Works fine here...
– Uwe Ziegenhagen
Nov 22 '18 at 13:10
add a comment |
This thing doesn't even work!
– Germa Vinsmoke
Nov 22 '18 at 12:49
@Uwe Ziegenhagen it works just displaying the result in on the GUIs window, not in it.
– Louis Botha
Nov 22 '18 at 12:52
Place a result label east to the "=" label and use theconfigure
method of the label. I updated my code
– Uwe Ziegenhagen
Nov 22 '18 at 13:09
@GermaVinsmoke: Works fine here...
– Uwe Ziegenhagen
Nov 22 '18 at 13:10
This thing doesn't even work!
– Germa Vinsmoke
Nov 22 '18 at 12:49
This thing doesn't even work!
– Germa Vinsmoke
Nov 22 '18 at 12:49
@Uwe Ziegenhagen it works just displaying the result in on the GUIs window, not in it.
– Louis Botha
Nov 22 '18 at 12:52
@Uwe Ziegenhagen it works just displaying the result in on the GUIs window, not in it.
– Louis Botha
Nov 22 '18 at 12:52
Place a result label east to the "=" label and use the
configure
method of the label. I updated my code– Uwe Ziegenhagen
Nov 22 '18 at 13:09
Place a result label east to the "=" label and use the
configure
method of the label. I updated my code– Uwe Ziegenhagen
Nov 22 '18 at 13:09
@GermaVinsmoke: Works fine here...
– Uwe Ziegenhagen
Nov 22 '18 at 13:10
@GermaVinsmoke: Works fine here...
– Uwe Ziegenhagen
Nov 22 '18 at 13:10
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%2f53430996%2fpython-costing-calculator-output%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
2
Could you add the specific problem you are running into and perhaps an error message. This is very broad at the moment
– Sven Harris
Nov 22 '18 at 12:32
@SvenHarris it's running so I can add the height & width but upon hitting enter nothing happens.
– Louis Botha
Nov 22 '18 at 12:44