Комментарии:
Hey, why you have placed columnspan parameter and applied it on the Entry widget? The other (button) widgets inherit it?
ОтветитьThanks u🎉
Ответитьi wonder about lambda function , i never see to use function outside and use inside lambda , can anyone tell me how it work
Ответитьwidth and padx button, how different?
Ответитьhow to fix Tlc/Tk error
Ответитьsir my global variable aint working
ОтветитьHow to make the tkinter window flexible when maximizing or adjusting the size of the window?
ОтветитьFor python 3.10, with pycharm, in Ubuntu, it's lambda instead of Lambda.
Ответитьi love this
ОтветитьAmazing
Ответитьgouwatom shivapondiyan
Ответитьgod bless you men thanks alot ❤❤❤
ОтветитьHello. Its from Bhutan. This video really helped me. Kadrinchey!
ОтветитьPlease continue to make videos, you are truly a great creator and help so many people like me learn to code
ОтветитьThanks for the great intro to python. Can't believe my first project worked:)
Can you explain how to limit input to the GUI or easily exclude letters and non 'math' symbols from the keyboard please?
I´ve been trying to bind the buttons to keys on the keyboard, every time it seems to just type out all the numvers and they keys don't seem to do anything. Any advice?
Ответить"its a program, we can build it and that should be cool"
~John
any source code available?
Ответитьsus
ОтветитьI enjoy how fun you make your lessons, 😃Thank you
ОтветитьHello ! Could not we have created an Object "Button" instead of copy/paste all these lines ? Thank you
ОтветитьONG
ОтветитьHow’s it going?
Ответитьhow do you know to set the padx of "=" is 91 ???
ОтветитьCan anyone write the code in the description
ОтветитьGreat teaching ! This playlist is paced so well. I've been going in circles trying to get started with Tkinter till now. This gave me a confidence boost ! Thank you!
Ответитьit says that "Lambda is not defined" What Should i do?
ОтветитьLesson check. Thanks.
Ответитьnice..
ОтветитьHey, could anyone please guide me to how to runs these functions(-,+,/,*) with 3 integers, using Tkinter. Thanks!!!
Ответитьits says invalid syntax for me. That problem came in when there was lambda: button_click(1))
and that problem says the : is the problem
😳Is it "Lambda" ? It looks like "Lambda"!! 🧐 Oh no wait, it is "lambda" with "l" not "L" 😓 what a confusing "text_fönt" 🤣
Ответитьwhat does the lambda do??
ОтветитьI like your tutorials but i want to know that how can we make that
First when we start a start button will be visible and when we click it the screen changes to this calculator in that screen only not in another screen
So please tell me
And also
Thank You
I get a syntax error associated with the Lambda; based on some Stack Overflow comments this looks like it's not possible to use in Python 3? I should go try my older version of Python and see if it works there. Not sure how to get around this. OK never mind thanks, I saw your answer about lowercase L in "lambda". But YOUR screen keeps capitalizing them! At least it looks like uppercase.
ОтветитьIt would be helpful for us if you write the script in the description too.
But I like your videos.
I request you to please slow speaking because we can't understand what you are saying.
My English is weak .
❤😘😍
ОтветитьI made it better!
from tkinter import *
root = Tk()
root.title("Calculator")
def click(val):
inputField.insert(END,str(val))
def clear():
inputField.delete(0,END)
def equals():
exp = inputField.get().replace("÷","/").replace("X","*")
clear()
inputField.insert(0,str(eval(exp)))
def backspace():
val = inputField.get()[0:-1]
clear()
inputField.insert(0,val)
inputField=Entry(root,width=30,borderwidth=10)
inputField.grid(row=0,column=0,columnspan=3,padx=20,pady=20)
button_backSpace = Button(root,text="⌫",padx=15,pady=15,command=lambda:backspace()).grid(row=6,column=2)
button_0 = Button(root,text="0",padx=20,pady=20,command=lambda:click("0")).grid(row=6,column=1)
button_equals = Button(root,text="=",padx=20,pady=20,command=lambda:equals()).grid(row=6,column=0)
button_1 = Button(root,text="1",padx=20,pady=20,command=lambda:click("1")).grid(row=5,column=2)
button_2 = Button(root,text="2",padx=20,pady=20,command=lambda:click("2")).grid(row=5,column=1)
button_3 = Button(root,text="3",padx=20,pady=20,command=lambda:click("3")).grid(row=5,column=0)
button_4 = Button(root,text="4",padx=20,pady=20,command=lambda:click("4")).grid(row=4,column=2)
button_5 = Button(root,text="5",padx=20,pady=20,command=lambda:click("5")).grid(row=4,column=1)
button_6 = Button(root,text="6",padx=20,pady=20,command=lambda:click("6")).grid(row=4,column=0)
button_7 = Button(root,text="7",padx=20,pady=20,command=lambda:click("7")).grid(row=3,column=2)
button_8 = Button(root,text="8",padx=20,pady=20,command=lambda:click("8")).grid(row=3,column=1)
button_9 = Button(root,text="9",padx=20,pady=20,command=lambda:click("9")).grid(row=3,column=0)
button_dot = Button(root,text=".",padx=20,pady=20,command=lambda:click(".")).grid(row=2,column=2)
button_clear = Button(root,text="C",padx=20,pady=20,command=lambda:clear()).grid(row=2,column=1)
button_div = Button(root,text="÷",padx=20,pady=20,command=lambda:click("÷")).grid(row=2,column=0)
button_mul = Button(root,text="X",padx=20,pady=20,command=lambda:click("X")).grid(row=1,column=2)
button_minus = Button(root,text="-",padx=20,pady=20,command=lambda:click("-")).grid(row=1,column=1)
button_add = Button(root,text="+",padx=20,pady=20,command=lambda:click("+")).grid(row=1,column=0)
root.mainloop()from tkinter import *
root = Tk()
root.title("Calculator")
def click(val):
inputField.insert(END,str(val))
def clear():
inputField.delete(0,END)
def equals():
exp = inputField.get().replace("÷","/").replace("X","*")
clear()
inputField.insert(0,str(eval(exp)))
def backspace():
val = inputField.get()[0:-1]
clear()
inputField.insert(0,val)
inputField=Entry(root,width=30,borderwidth=10)
inputField.grid(row=0,column=0,columnspan=3,padx=20,pady=20)
button_backSpace = Button(root,text="⌫",padx=15,pady=15,command=lambda:backspace()).grid(row=6,column=2)
button_0 = Button(root,text="0",padx=20,pady=20,command=lambda:click("0")).grid(row=6,column=1)
button_equals = Button(root,text="=",padx=20,pady=20,command=lambda:equals()).grid(row=6,column=0)
button_1 = Button(root,text="1",padx=20,pady=20,command=lambda:click("1")).grid(row=5,column=2)
button_2 = Button(root,text="2",padx=20,pady=20,command=lambda:click("2")).grid(row=5,column=1)
button_3 = Button(root,text="3",padx=20,pady=20,command=lambda:click("3")).grid(row=5,column=0)
button_4 = Button(root,text="4",padx=20,pady=20,command=lambda:click("4")).grid(row=4,column=2)
button_5 = Button(root,text="5",padx=20,pady=20,command=lambda:click("5")).grid(row=4,column=1)
button_6 = Button(root,text="6",padx=20,pady=20,command=lambda:click("6")).grid(row=4,column=0)
button_7 = Button(root,text="7",padx=20,pady=20,command=lambda:click("7")).grid(row=3,column=2)
button_8 = Button(root,text="8",padx=20,pady=20,command=lambda:click("8")).grid(row=3,column=1)
button_9 = Button(root,text="9",padx=20,pady=20,command=lambda:click("9")).grid(row=3,column=0)
button_dot = Button(root,text=".",padx=20,pady=20,command=lambda:click(".")).grid(row=2,column=2)
button_clear = Button(root,text="C",padx=20,pady=20,command=lambda:clear()).grid(row=2,column=1)
button_div = Button(root,text="÷",padx=20,pady=20,command=lambda:click("÷")).grid(row=2,column=0)
button_mul = Button(root,text="X",padx=20,pady=20,command=lambda:click("X")).grid(row=1,column=2)
button_minus = Button(root,text="-",padx=20,pady=20,command=lambda:click("-")).grid(row=1,column=1)
button_add = Button(root,text="+",padx=20,pady=20,command=lambda:click("+")).grid(row=1,column=0)
root.mainloop()
bald
ОтветитьLooks nice but how to stylize the calculator?(colors/shapes/etc..)
Ответитьnum1 = input("Type in the first number: ")
num2 = input("Type in the second number: ")
result = float(num1) + float(num2)
print(result)
Please help...
button_1 = Button(root, text="1", padx=30, pady=25, command=Lambda: button_click(1), font=number_font)
^
SyntaxError: invalid syntax
What version of python is everyone using? I'm using 3.9.2 and getting the following error:
button_1 = Button(root, text="1", padx=40, pady=20, command=Lambda: button_click(1))
^
SyntaxError: invalid syntax
I keep rewatching because my calculator window is way bigger that yours. My padx and pady are the same
Ответитьcan you share the code?
Ответить