Thanks man - you're clearly a great teacher. I'm a 42 year old bloke that's decided to get back into coding (was decent at Basic on the ol' C64 when I was young) to try and keep up with my kids and maybe even one day do something career-wise with it. Your vids are very inspiring as I learn infinitely better by actually 'doing' rather than going through independent tutorials on basic commands and trying to put them all together eventually. Thanks for explaining so well as you go!
@@bruhifyify5713 It really depends on your purpose. If you want to learn Java, learn Java. That said, I think it is generally easier to learn Java after Python since you already know the basic coding concepts and Java is more complex.
Thank you very very very much. I followed you and wrote everything after you learning everything as much as I could. Please continue. I’m your fan from KSA. Do not worry about me being from Middle East. I am one of the good guys hopefully.
Thank u sir. I understood everything very clearly. Hats off to u sir. I liked the way u seperated into parts and it really helped a lot . Can I know whether there is a playlist for these types of tutorials for simple apps .
Can we take user input as we did in the BMI app.. so basically, what I want is we can input values 2 ways: i) from the buttons and ii) from the keyboard/user directly without buttons.
Hiya - yep, this is definitely doable. I've actually already recorded a video on how to do this. It is currently Members Only, but I'll release it to non-members later in the week, or early next week. Keep on codin'!
"The reason why lambda functions become so useful is the fact that it is usually more convenient to use simple and concise lambda notation rather than defining a new function in a traditional way, especially if the function is designed to do only one single operation rather than serve as a repeatable component." Still not sure why you need to turn add() into a function but I guess thats how tkinter works. Maybe its supposed to be a callback to execute it? Not sure if I know what Im talking about lol
Nicely done once more, Christian. I enjoyed learning about the eval statement. Boy does the GUI always look terrible in Windows, though. Nothing a bit of geometry and button-width adjusting doesn't fix, but yours always looks much nicer! So, I'll finally take a ding on Windows... this time. As a former payroll administrator, I love my ten-key, so is there any way to code in any key bindings to allow for keying in the expressions instead of clicking on them?
Thanks! Congrats for making it to your second month as a member - hope you like the cool snakehead badge! Definitely tkinter is pretty ugly but easy for learning. There is a way to customize it but I haven't done much with that myself - saving it for the future! Yes, there is a way to do that - I'll try to get a video out on that subject for you. Have a good one!
@@TokyoEdTech Thanks, but don't worry about making a video for that. I know I asked about the binding, but I quickly realized I don't plan on using Tkinter and just watch the tutorials for the new code you bring to it (like eval). Thanks though! And woot on my second month! I commented on Discord about it and the badges, but I didn't use a "@", so I guess you don't get notified? I don't either (even with the "@", but I just check it for a couple seconds every day. I don't use Twitter, so I tend to find the "@" thing a bit silly, but that's just me behind on the times! ;) As for the snake, now I see it. I thought it was an alien at first, so you'll understand why I questioned the badges in my Discord comment. Cool beans now, but I still can't make out what the next image is. Brain? Mushroom?
I don't get notifications for Discord unless I'm on my tablet (but you do need the @ mark). The next image is supposed to be a pong paddle, but I need to redo the dimensions as it got sqashed!
I saw this youtube channel today .if i saw it before i watch all the videos in this channel.this is best youtube channel.i started watching your videos today.them are super.I hope i can watch all the python and java videos.I subscribed this channel and i will share this to my friends.good luck 👍
I think after you press = it shouldn't continue using the original expression. 2+2*3=8 2+2=4 and then *3 should give 12 This calculator continues giving 8 as result. Adding this at line 35 "expression = str(result)" seems to work. Is it correct? I'm still learning :D
Your videos really help, keep up the good work :) I am trying to add extra features to the calculator and I noticed that if the number on the result label is 13 digits or more the GUI becomes all messd up (the space between the button becomes to large), do you have any solutions?
I ran into a slight problem here. If you insert a zero before a significant whole number, python gives this error message: "SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers"
@@baneofcronus6979 Interesting - I guess that is a rule in Python. So, you need to avoid entering a 0 at the start of a number. So use 8 instead of 08. Not sure why you would add a 0 at the start of a number though.
You're welcome. A delete button would be pretty straightforward. Create the button. Create the function. In the function get the current formula and then do something like this: string = "12345" string = string[0:len(string)-1]
@@muhammadnazhimmaulana6315 I think the size is determined by your OS - on Mac, the buttons are really small. As Dhiraj says, you can manually change the height and width.
@@TokyoEdTech I did exactly what you did, both tutorials, then to make sure I did everything correctly I checked the github code and mine was the exact same.
@@awesome_pi_guy If you are talking about quadratic, you could implement the quadratic formula on a given quadratic to solve. Other wise, you would have to perform some other algorithms to solve for x. For ex: if you have 3x +6 = 18, the program should go through the side with x in it. It sees the 6 that doesn't have a x. It subtracts it on both sides. So now it has 3x = 12. Then, repeat this process till x is by itself. Then, you divide 3 on both sides. The code gets x = 4. Because x is by itself and there is no number be multiplied to it, it means x is 4 and then it outputs the answer.
Thanks man - you're clearly a great teacher.
I'm a 42 year old bloke that's decided to get back into coding (was decent at Basic on the ol' C64 when I was young) to try and keep up with my kids and maybe even one day do something career-wise with it.
Your vids are very inspiring as I learn infinitely better by actually 'doing' rather than going through independent tutorials on basic commands and trying to put them all together eventually.
Thanks for explaining so well as you go!
You're quite welcome! I'm a bit older than you and got my start coding in BASIC as well. I had a VIC-20 and C64 - glory days! Keep on codin'!
Using this to code in a calculus calculator. Not really to make a project but to reinforce what I learned in my calculus courses
That's a great way to learn!
the timing is perfect, i was having trouble making a calculator earlier
Glad to hear it!
@@TokyoEdTech i have a question, is it a good idea to learn java after python?
@@bruhifyify5713 It really depends on your purpose. If you want to learn Java, learn Java. That said, I think it is generally easier to learn Java after Python since you already know the basic coding concepts and Java is more complex.
@@TokyoEdTech ok, thank you so much!
Thank you very very very much. I followed you and wrote everything after you learning everything as much as I could.
Please continue. I’m your fan from KSA. Do not worry about me being from Middle East. I am one of the good guys hopefully.
Thanks - glad you found the tutorial helpful. Very happy to have viewers from all over the world - as-salamu alaykum!
Loving these tkinter tutorials! Keep up the great work!
Thanks!
As soon as you said you will be back, an add played. Perfect timing lol.
That UA-cam algorithm knows its stuff!
Thank u sir. I understood everything very clearly. Hats off to u sir.
I liked the way u seperated into parts and it really helped a lot .
Can I know whether there is a playlist for these types of tutorials for simple apps .
Hiya - thanks! I don't have a specific playlist for apps. Sorry.
U did a really great job...KEEP ON IT
Thanks!
IVE BEEN WAITING FOR THIS! Oh and I’m learning Japanese I’m been learning for about a month just thought I would share! ども
Dou itashimashite!
Thanks for listening to my request for making a video on creating a calculator and keep up the good work you are an awesome youtuber😁😁😁😁😁😁😁😁😁
You're welcome - I can't do all requests, but this one was a natural follow-up to my last video.
@@TokyoEdTech OK😄
I fucking love this channel, am learning so much with these videos, thanks and hats off to you mate
Thanks! Much appreciated.
TYSM my first working python project
You are welcome!
pov: hecker learns to heck
Thank you.....it was really helpful....and going slowly helped me understand better
Glad to hear it!
Can we take user input as we did in the BMI app.. so basically, what I want is we can input values 2 ways: i) from the buttons and ii) from the keyboard/user directly without buttons.
Hiya - yep, this is definitely doable. I've actually already recorded a video on how to do this. It is currently Members Only, but I'll release it to non-members later in the week, or early next week. Keep on codin'!
@@TokyoEdTech Thanks!
"The reason why lambda functions become so useful is the fact that it is usually more convenient to use simple and concise lambda notation rather than defining a new function in a traditional way, especially if the function is designed to do only one single operation rather than serve as a repeatable component."
Still not sure why you need to turn add() into a function but I guess thats how tkinter works. Maybe its supposed to be a callback to execute it? Not sure if I know what Im talking about lol
In this case it allows us to pass parameters to the function - otherwise we can only call functions without parameters with tkinter.
Nicely done once more, Christian. I enjoyed learning about the eval statement. Boy does the GUI always look terrible in Windows, though. Nothing a bit of geometry and button-width adjusting doesn't fix, but yours always looks much nicer! So, I'll finally take a ding on Windows... this time. As a former payroll administrator, I love my ten-key, so is there any way to code in any key bindings to allow for keying in the expressions instead of clicking on them?
Thanks! Congrats for making it to your second month as a member - hope you like the cool snakehead badge!
Definitely tkinter is pretty ugly but easy for learning. There is a way to customize it but I haven't done much with that myself - saving it for the future! Yes, there is a way to do that - I'll try to get a video out on that subject for you. Have a good one!
@@TokyoEdTech Thanks, but don't worry about making a video for that. I know I asked about the binding, but I quickly realized I don't plan on using Tkinter and just watch the tutorials for the new code you bring to it (like eval). Thanks though!
And woot on my second month! I commented on Discord about it and the badges, but I didn't use a "@", so I guess you don't get notified? I don't either (even with the "@", but I just check it for a couple seconds every day. I don't use Twitter, so I tend to find the "@" thing a bit silly, but that's just me behind on the times! ;)
As for the snake, now I see it. I thought it was an alien at first, so you'll understand why I questioned the badges in my Discord comment. Cool beans now, but I still can't make out what the next image is. Brain? Mushroom?
I don't get notifications for Discord unless I'm on my tablet (but you do need the @ mark). The next image is supposed to be a pong paddle, but I need to redo the dimensions as it got sqashed!
@@TokyoEdTech Ohhh! That's what it is! My next guess was one of those bloaty things from Mass Effect! ;)
@@ethansofiadada Close! lol
You are a real coder.best work
Thanks!
I saw this youtube channel today .if i saw it before i watch all the videos in this channel.this is best youtube channel.i started watching your videos today.them are super.I hope i can watch all the python and java videos.I subscribed this channel and i will share this to my friends.good luck 👍
Thanks - back at you!
can you give me the codes of calculator please?
does this app follow order of oporation? Or just they way you enter it
It should follow order of operations.
Excellent! Thank you so much!
You're very welcome!
tkinter looks super easy to start learning :)
It is!
Hi sir, where do you write codes and where do you run them? I mean which programs should I download?
My laptop's operation system is Windows 10
You’re in luck - I’ve made a video about this exact topic. Enjoy! ua-cam.com/video/4bL-lCP2tec/v-deo.html
very clear and clean code! thank u so much.
You're welcome!
I think after you press = it shouldn't continue using the original expression.
2+2*3=8
2+2=4 and then *3 should give 12
This calculator continues giving 8 as result.
Adding this at line 35 "expression = str(result)" seems to work. Is it correct? I'm still learning :D
I agree. As long as your code works, the it is ok!
THX FOR THIS GREAT TUTORIAL
You're welcome!
imagine using the calculator app so parents thought you are coding, but you cheated on math exam
(thanks btw)
You are welcome!
This is really great was having problems earlier but with this am satisfied
Good to hear!
I was waiting for this!!
Wait no more! :)
@@TokyoEdTech Thank you!
did this coding works on python in vscodes ?
It should.
when I run it everything was okay but answer is not comming after pressing "=" button
Gotta share your code, otherwise I can't help you.
Very helpful
But please how do I add a square root and square command
Use the same basic coding structure and to square something you'd add:
** 2
For square root you'd add:
** 0.5
Good luck!
i have a problem with the dot button
File "", line 1
19.9+ 7 .5
^
SyntaxError: invalid syntax
i solved the problem
Good to hear!
I added a delete button to delete a number if I made a mistake
Cool!
Your videos really help, keep up the good work :) I am trying to add extra features to the calculator and I noticed that if the number on the result label is 13 digits or more the GUI becomes all messd up (the space between the button becomes to large), do you have any solutions?
Hmmm...you'd probably have to play around with the size of the buttons by making them larger from the beginning. Check the docs on how to do that.
@@TokyoEdTech Thank you I'll try that
Great tutorial and do you plan to mix tk and turtle to create games?
Thanks. I wasn't planning on it although it is possible. The turtle module is built on top of tkinter.
@@TokyoEdTech cool! And have an amazing day
@@TokyoEdTech hello, could this be done in turtle or could the two tk and turtle mix? pastebin.com/W5v46fxD
Oh pydroid 💯
i have a question, whats the best IDE for python?
"Best' is a personal choice, but here's what I've used: ua-cam.com/video/4bL-lCP2tec/v-deo.html
Consider PyCharm
@@MarkCrowtherTheTester Probably not gonna happen, but if it works for you all good!
loving it
Thanks!
Any suggestion on the most probable reason there are spaces between the columns?
By default there is a certain amount of padding.
@@TokyoEdTech Thanks. I can live with it. The calculator works perfectly.
@@tentative_iv6398 I'm with you on that - function > design!
You mentioned that using global variables is considered bad practice, so how would you do this without using them?
Typically, you'd create a class such as Game and then run everything inside the Game class.
thankyou brow! continue
You're welcome!
First ❤️❤️
Gold!
@@TokyoEdTech thanks you
I ran into a slight problem here. If you insert a zero before a significant whole number, python gives this error message:
"SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers"
Interesting. Doesn't the try/except block catch that?
It does. The try except block throws up an error every time that happens.
The error is shown when you try on the command prompt. If you run the calculation in the shell, you get "SyntaxError: invalid token"
@@baneofcronus6979 Interesting - I guess that is a rule in Python. So, you need to avoid entering a 0 at the start of a number. So use 8 instead of 08. Not sure why you would add a 0 at the start of a number though.
Thanks for this video, helped me learn a lot plus create my own calculator lol.. Curious though how would you create a Delete button?
You're welcome.
A delete button would be pretty straightforward. Create the button. Create the function. In the function get the current formula and then do something like this:
string = "12345"
string = string[0:len(string)-1]
@@TokyoEdTech I’m going to give it a shot
@@TokyoEdTech Done and thanks again!
def delete():
If expression != “ “:
expression = expression[0:len(expression)-1]
label_result.config(text=expression)
@@goodtechnation3075 Awesome - thanks for sharing!!!!
Brother, can you make app making series? With tkinter, It will be great!
Hiya - do you mean mobile apps? If so, as far as I know you cannot use tkinter for that purpose.
@@TokyoEdTech ohh!
Then I have heard that kivy MD is a best platform for mobile apps?
@@nexgenofficial665 I've heard about Kivy for making apps in Python, but haven't tried it myself yet.
@@TokyoEdTech no problem. Thanks!
not sure how to pause this
youtube:we got you
'ad starts playing'
UA-cam giveth when thou needeth!
i am really appreciate keep it up tnx for share is for us
No worries - glad to help! Keep on codin'!
Thank you so much sir
Most welcome!
Thanku sooo much🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺💝💝💝
You are quite welcome!
I want to ask, why when I execute the code the size of the buttons are not the same as yours in the video? (I have followed the steps carefully)
Not sure - I'd have to see your code.
Use height= , width= some no. According to what u want
import tkinter
root = tkinter.Tk()
root.title("Kalkulator")
# Membuat function
def add(value):
print(value)
def clear():
pass
def calculate():
pass
# Membuat tampilan
label_result = tkinter.Label(root, text="")
label_result.grid(row= 0, column= 0, columnspan=4)
button_1 = tkinter.Button(root, text="1", command=lambda: add("1"))
button_1.grid(row=1, column=0)
button_2 = tkinter.Button(root, text="2", command=lambda: add("2"))
button_2.grid(row=1, column=1)
button_3 = tkinter.Button(root, text="3", command=lambda: add("3"))
button_3.grid(row=1, column=2)
button_devide = tkinter.Button(root, text="/", command=lambda: add("/"))
button_devide.grid(row=1, column=3)
button_4 = tkinter.Button(root, text="4", command=lambda: add("4"))
button_4.grid(row=2, column=0)
button_5 = tkinter.Button(root, text="5", command=lambda: add("5"))
button_5.grid(row=2, column=1)
button_6 = tkinter.Button(root, text="6", command=lambda: add("6"))
button_6.grid(row=2, column=2)
button_times = tkinter.Button(root, text="*", command=lambda: add("*"))
button_times.grid(row=2, column=3)
button_7 = tkinter.Button(root, text="7", command=lambda: add("7"))
button_7.grid(row=3, column=0)
button_8 = tkinter.Button(root, text="8", command=lambda: add("8"))
button_8.grid(row=3, column=1)
button_9 = tkinter.Button(root, text="9", command=lambda: add("9"))
button_9.grid(row=3, column=2)
button_minus = tkinter.Button(root, text="-", command=lambda: add("-"))
button_minus.grid(row=3, column=3)
button_clear = tkinter.Button(root, text="C", command=lambda: clear())
button_clear.grid(row=4, column=0)
button_0 = tkinter.Button(root, text="0", command=lambda: add("0"))
button_0.grid(row=4, column=1)
button_dot = tkinter.Button(root, text=".", command=lambda: add("."))
button_dot.grid(row=4, column=2)
button_plus = tkinter.Button(root, text="+", command=lambda: add("+"))
button_plus.grid(row=4, column=3)
button_equal = tkinter.Button(root, text="=", width=16,command=lambda: calculate())
button_equal.grid(row=5, column=0, columnspan=4)
root.mainloop()
How is it, that's my code
@@muhammadnazhimmaulana6315 I think the size is determined by your OS - on Mac, the buttons are really small. As Dhiraj says, you can manually change the height and width.
@@TokyoEdTech Okay, I only need to change the size myself right?
After finishing the equals button columnspan there's huge gaps between each button, what do I do to fix it?
You have play around with the size (width/height) and make sure the columns are aligned correctly. If you share your code I can take a look.
@@TokyoEdTech I did exactly what you did, both tutorials, then to make sure I did everything correctly I checked the github code and mine was the exact same.
It's easy to miss something small. If you share your code I'll take a look.
@@TokyoEdTech To be honest I'm fine with it, since I mainly are following tutorials to learn how to program in various languages. Ty though!
You're welcome - keep on codin'!
I can't figure out how the buttons turn out to be squarish rather than rectangular though you did not add height to them.
It's automatically sized.
@@TokyoEdTechmy buttons looks thin when I create them. Why is it diffferent? I have to add manual padding to make a square shaped button like yours.
@@swastiksarkar It'll vary by system and font.
can you make a tutorial on how to make this full color?
I think you just use fg and bg or something like that to change the text and background color of the buttons.
Thank you
You're welcome.
You should make a gaming channel to play game's like among us, mincraft and all the other game's.
Thanks, but I am not a gamer. Also I prefer open source software so check out Minetest instead of Minecraft.
Ok
You don't need to be a Gamer to play game's.
True - but if you are going to start a UA-cam channel about gaming you should be interested in the topic and know something about it.
21:43
I keep getting an error for expression as “Undefined”
Doesn’t matter, I was doing this within multiple functions as I was making a pretty large program
Video really helped thanks 👍
Good to hear.
Well I'm going to try this right now. I hope this works
Good luck!
Wait nevermind that was addressed in the video. Tkinter seems like a pain to work with
Yes and no. GUI coding is pretty easy overall but there are lots of little details to keep track of.
can u give ma a link for your phyton please
Check the description (Geany).
Best tutorial....
Thanks - glad you liked it!
But also not the last
:)
i keep getting this error message:
"module 'tkinter' has no attribute 'label'
Hiya - try Label with a capital L.
what about space arena?
I want to get back to it but I've been waiting to get my work computer which has the code on it. Back to work tomorrow so stay tuned!
Not first
Next time!
Hi I have a question, the calculator GUI keys keeps expanding and moving. I don't know how to fix it. Could you help please?
Make sure you are using the correct grid coordinates - double check.
Could you make a algebra calculator
I'm not really sure how to go about that - what makes it different from a regular calculator?
@@TokyoEdTech It trys to solve for x
Oh..you're on your own on that one!
@@TokyoEdTech Ok
@@awesome_pi_guy If you are talking about quadratic, you could implement the quadratic formula on a given quadratic to solve. Other wise, you would have to perform some other algorithms to solve for x.
For ex:
if you have 3x +6 = 18,
the program should go through the side with x in it.
It sees the 6 that doesn't have a x.
It subtracts it on both sides.
So now it has 3x = 12.
Then, repeat this process till x is by itself.
Then, you divide 3 on both sides.
The code gets x = 4. Because x is by itself and there is no number be multiplied to it, it means x is 4 and then it outputs the answer.
nice
Thanks
I don't have computer , now how can i learn python?
I think there are development environments that work on phones and tablets, but I'm not sure what they are called. Check Google.
Mimo
SoloLearn has a mobile app
@@MarkCrowtherTheTester Thanks for the recommendation!