Тёмный

Python calculator app 🖩 

Bro Code
Подписаться 2,2 млн
Просмотров 76 тыс.
50% 1

python calculator program project tutorial example explained
#python #calculator #program
****************************************************************
Python Calculator
****************************************************************
from tkinter import *
def button_press(num):
global equation_text
equation_text = equation_text + str(num)
equation_label.set(equation_text)
def equals():
global equation_text
try:
total = str(eval(equation_text))
equation_label.set(total)
equation_text = total
except SyntaxError:
equation_label.set("syntax error")
equation_text = ""
except ZeroDivisionError:
equation_label.set("arithmetic error")
equation_text = ""
def clear():
global equation_text
equation_label.set("")
equation_text = ""
window = Tk()
window.title("Calculator program")
window.geometry("500x500")
equation_text = ""
equation_label = StringVar()
label = Label(window, textvariable=equation_label, font=('consolas',20), bg="white", width=24, height=2)
label.pack()
frame = Frame(window)
frame.pack()
button1 = Button(frame, text=1, height=4, width=9, font=35,
command=lambda: button_press(1))
button1.grid(row=0, column=0)
button2 = Button(frame, text=2, height=4, width=9, font=35,
command=lambda: button_press(2))
button2.grid(row=0, column=1)
button3 = Button(frame, text=3, height=4, width=9, font=35,
command=lambda: button_press(3))
button3.grid(row=0, column=2)
button4 = Button(frame, text=4, height=4, width=9, font=35,
command=lambda: button_press(4))
button4.grid(row=1, column=0)
button5 = Button(frame, text=5, height=4, width=9, font=35,
command=lambda: button_press(5))
button5.grid(row=1, column=1)
button6 = Button(frame, text=6, height=4, width=9, font=35,
command=lambda: button_press(6))
button6.grid(row=1, column=2)
button7 = Button(frame, text=7, height=4, width=9, font=35,
command=lambda: button_press(7))
button7.grid(row=2, column=0)
button8 = Button(frame, text=8, height=4, width=9, font=35,
command=lambda: button_press(8))
button8.grid(row=2, column=1)
button9 = Button(frame, text=9, height=4, width=9, font=35,
command=lambda: button_press(9))
button9.grid(row=2, column=2)
button0 = Button(frame, text=0, height=4, width=9, font=35,
command=lambda: button_press(0))
button0.grid(row=3, column=0)
plus = Button(frame, text='+', height=4, width=9, font=35,
command=lambda: button_press('+'))
plus.grid(row=0, column=3)
minus = Button(frame, text='-', height=4, width=9, font=35,
command=lambda: button_press('-'))
minus.grid(row=1, column=3)
multiply = Button(frame, text='*', height=4, width=9, font=35,
command=lambda: button_press('*'))
multiply.grid(row=2, column=3)
divide = Button(frame, text='/', height=4, width=9, font=35,
command=lambda: button_press('/'))
divide.grid(row=3, column=3)
equal = Button(frame, text='=', height=4, width=9, font=35,
command=equals)
equal.grid(row=3, column=2)
decimal = Button(frame, text='.', height=4, width=9, font=35,
command=lambda: button_press('.'))
decimal.grid(row=3, column=1)
clear = Button(window, text='clear', height=4, width=12, font=35,
command=clear)
clear.pack()
window.mainloop()
****************************************************************
Bro Code merch store 👟 :
===========================================================
teespring.com/...
===========================================================
music credits 🎼 :
===========================================================
Up In My Jam (All Of A Sudden) by - Kubbi / kubbi
Creative Commons - Attribution-ShareAlike 3.0 Unported- CC BY-SA 3.0
Free Download / Stream: bit.ly/2JnDfCE
Music promoted by Audio Library • Up In My Jam (All Of A...
===========================================================

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 118   
@BroCodez
@BroCodez 3 года назад
# **************************************************************** # Python Calculator # **************************************************************** from tkinter import * def button_press(num): global equation_text equation_text = equation_text + str(num) equation_label.set(equation_text) def equals(): global equation_text try: total = str(eval(equation_text)) equation_label.set(total) equation_text = total except SyntaxError: equation_label.set("syntax error") equation_text = "" except ZeroDivisionError: equation_label.set("arithmetic error") equation_text = "" def clear(): global equation_text equation_label.set("") equation_text = "" window = Tk() window.title("Calculator program") window.geometry("500x500") equation_text = "" equation_label = StringVar() label = Label(window, textvariable=equation_label, font=('consolas',20), bg="white", width=24, height=2) label.pack() frame = Frame(window) frame.pack() button1 = Button(frame, text=1, height=4, width=9, font=35, command=lambda: button_press(1)) button1.grid(row=0, column=0) button2 = Button(frame, text=2, height=4, width=9, font=35, command=lambda: button_press(2)) button2.grid(row=0, column=1) button3 = Button(frame, text=3, height=4, width=9, font=35, command=lambda: button_press(3)) button3.grid(row=0, column=2) button4 = Button(frame, text=4, height=4, width=9, font=35, command=lambda: button_press(4)) button4.grid(row=1, column=0) button5 = Button(frame, text=5, height=4, width=9, font=35, command=lambda: button_press(5)) button5.grid(row=1, column=1) button6 = Button(frame, text=6, height=4, width=9, font=35, command=lambda: button_press(6)) button6.grid(row=1, column=2) button7 = Button(frame, text=7, height=4, width=9, font=35, command=lambda: button_press(7)) button7.grid(row=2, column=0) button8 = Button(frame, text=8, height=4, width=9, font=35, command=lambda: button_press(8)) button8.grid(row=2, column=1) button9 = Button(frame, text=9, height=4, width=9, font=35, command=lambda: button_press(9)) button9.grid(row=2, column=2) button0 = Button(frame, text=0, height=4, width=9, font=35, command=lambda: button_press(0)) button0.grid(row=3, column=0) plus = Button(frame, text='+', height=4, width=9, font=35, command=lambda: button_press('+')) plus.grid(row=0, column=3) minus = Button(frame, text='-', height=4, width=9, font=35, command=lambda: button_press('-')) minus.grid(row=1, column=3) multiply = Button(frame, text='*', height=4, width=9, font=35, command=lambda: button_press('*')) multiply.grid(row=2, column=3) divide = Button(frame, text='/', height=4, width=9, font=35, command=lambda: button_press('/')) divide.grid(row=3, column=3) equal = Button(frame, text='=', height=4, width=9, font=35, command=equals) equal.grid(row=3, column=2) decimal = Button(frame, text='.', height=4, width=9, font=35, command=lambda: button_press('.')) decimal.grid(row=3, column=1) clear = Button(window, text='clear', height=4, width=12, font=35, command=clear) clear.pack() window.mainloop()
@rorornk0758
@rorornk0758 2 года назад
Hi
@kaldtechtitan
@kaldtechtitan Год назад
Arigatou boss 。⁠◕⁠‿⁠◕⁠。
@tritontig3r
@tritontig3r Год назад
Heard of Github ?
@ztztadesse
@ztztadesse 2 месяца назад
0:25
@BB-xc6bp
@BB-xc6bp 2 дня назад
😢
@adityanaik099
@adityanaik099 2 года назад
Made a simple calculator :) # Calculator program # In python #----------------------------- def addition(x,y): output1 = (x + y) return output1 #----------------------------- def subtraction(x,y): output2 = (x - y) return output2 #----------------------------- def multiplication(x,y): output3 = (x * y) return output3 #----------------------------- def division(x,y): output = (x / y) return output #----------------------------- def square(z): output4 = (z * z) return output4 #----------------------------- def cube(z): output5 = (z * z * z) return output5 #----------------------------- def factorial_pos(z): output6 = 1 for i in range(z,1,-1): output6 = (output6 * i) return output6 #----------------------------- def factorial_neg(z): output7 = -1 for i in range(z,-1): output7 = (output7 * i) return output7 #----------------------------- def exp_pos(b,p): output8 = 1 for i in range(p): output8 = (output8 * b) return output8 #----------------------------- def exp_neg(b,p): output9 = -1 for i in range(p): output9 = (output9 * b) return output9 #----------------------------- def mtp_tables_ps(x,y): print(" Result: ") for i in range(1,y+1): print(f"{x} x {i} = {x*i}") else: print(f''' These are the multiplication tables of {x} with-in the range of {y}''') #----------------------------- def mtp_tables_ng(x,y): print(" Result: ") for i in range(-1,(y-1),-1): print(f"{x} x {i} = {x*i}") else: print(f''' These are the multiplication tables of {x} with-in the range of {y}''') #----------------------------- def operator(c): if(c == ('+')): try: x = float(input("Enter 1st number : ")) y = float(input("Enter 2nd number : ")) except ValueError: print("You can only enter integers.Try to run again!") else: print("Result:") print(addition(x,y)) elif(c == ('-')): try: x = float(input("Enter 1st number : ")) y = float(input("Enter 2nd number : ")) except ValueError: print("You can only enter integers.Try to run again!") else: print("Result:") print(subtraction(x,y)) elif(c == ('*')): try: x = float(input("Enter 1st number : ")) y = float(input("Enter 2nd number : ")) except ValueError: print("You can only enter integers.Try to run again!") else: print("Result:") print(multiplication(x,y)) elif(c == ('/')): try: x = float(input("Enter 1st number : ")) y = float(input("Enter 2nd number : ")) division(x,y) except ValueError: print("You can only enter integers.Try to run again!") except ZeroDivisionError: print("You cant divide by 0.Try to run again!") else: print("Result:") print(division(x,y)) elif(c == ("**")): try: z = float(input("Enter the number to sqaure it : ")) except ValueError: print("You can only enter integers.Try to run again!") else: print("Result:") print(square(z)) elif(c == ("***")): try: z = float(input("Enter the number to cube it : ")) except ValueError: print("You can only enter integers.Try to run again!") else: print("Result:") print(cube(z)) elif(c == ('!')): try: z = int(input("Enter the number to calculate its factorial : ")) if(z > 0): print("Result:") print(factorial_pos(z)) elif(z < 0): print("Result:") print(factorial_neg(z)) else: if(z == 0): print("Result:") print(z*0) else: pass except ValueError: print("You can only enter Integers.Try to run again!") elif(c == ('exp')): try: b = int(input("Enter the base number : ")) p = int(input("Enter the power number : ")) if(p < 0): print("You cant enter negative integers as Power.Try to run again!") elif(b > 0): print("Result:") print(exp_pos(b,p)) elif(b < 0): print("Result:") print(exp_neg(b,p)) elif(b == 0): print("Result:") print(b*0) else: pass except ValueError: print("You can only enter Integers.Try to run again!") elif(c == "mtp"): try: x = int(input("Enter the number for its multiplication tables : ")) y = int(input("Enter the range for the tables : ")) if(y > 0): mtp_tables_ps(x,y) elif(y < 0): mtp_tables_ng(x,y) else: print("Result:") print(x*y) except ValueError: print("You can only enter Integers.Try to run again!") else: print("Invalid operator!") #----------------------------- def new_program(c): c = input('''Enter an operator sign: ('+' , '-' , '*' , '/' , '**' , '***' , '!' , 'exp' , 'mtp') : ''') operator(c) #----------------------------- c = input('''Enter an operator sign: ('+' , '-' , '*' , '/' , '**' , '***' , '!' , 'exp' , 'mtp') : ''') operator(c) print() ctn = input('''Do you want to continue your calculation? Enter 'y' for Yes / 'n' for No. : ''') ctn_cmd = ['y','Y','n','N'] while(ctn == 'y' or ctn == 'Y'): print() new_program(c) print() ctn = input('''Do you want to continue your calculation? Enter 'y' for Yes / 'n' for No. : ''') if(ctn == 'n' or ctn == 'N'): print() print("Thank you for using the calculator. ") else: if(ctn not in ctn_cmd): print("Invalid command!Try to run again.") else: pass #----------------------------- # Code finished successfully
@Redfoxbs
@Redfoxbs Месяц назад
awesome!!! but little bit hard to read
@blazer125
@blazer125 3 года назад
At first I was like "Could you go a little more in-depth with explaining the code?" But. That's when I realized I need to go on my own for deeper explanations. It makes it so much easier and satisfying to get yourself unstuck. Great Lesson Bro!
@juankorsia7909
@juankorsia7909 2 года назад
From deep of my heart. Thanks very much!!!
@BigMarc-wn1kw
@BigMarc-wn1kw 2 года назад
My buttons are not working even though I checked the video a lot of times and they won’t do anything when pressed. Do you know how to fix this?
@princesimfukwe9158
@princesimfukwe9158 2 года назад
Same here
@jaspreetsingh7441
@jaspreetsingh7441 Год назад
same
@tread2114
@tread2114 Год назад
Great video!
@tmahad5447
@tmahad5447 2 года назад
This video is helpful
@Joseph20003
@Joseph20003 6 месяцев назад
Hi bro, I'm a beginner in Python. First of all, thank you for the video, it helped me a lot. Second, I have a question: (I apologize if I make any grammatical mistakes, as I'm not very good at writing English) Why did you use lambda functions for the buttons? When I remove the lambda functions from the buttons and run the program, all the numbers and symbols are displayed without pressing any buttons. What is the reason for this?
@IMCYT
@IMCYT 2 года назад
I tried to code it myself before this, it went well but I made each function for each number, i probably need to learn more lol
@derpfisti2457
@derpfisti2457 Год назад
step 3 = done step 1 = done 👍 step 2 = done 🗯 great work again Bro!
@coachbussimulator6831
@coachbussimulator6831 2 года назад
cool
@davidhirschhorn2960
@davidhirschhorn2960 5 месяцев назад
Thanks. equation_label = StringVar() is not trivial - I had to look up more info. Is it automatically global, and in scope in all of the defined functions?
@theaddictor
@theaddictor 3 года назад
Thank you so much...it really helps me❤️
@NOTHING-en2ue
@NOTHING-en2ue Год назад
thank you sosososososoososososooooooooooooooooo much ❤
@milky_edge1123
@milky_edge1123 Год назад
I am not gonna lie it is criminal to be this good at code
@BohdanDmytriuk
@BohdanDmytriuk Год назад
thanks for the short and understandable tutorial
@hamzaammar4356
@hamzaammar4356 3 года назад
YOUR A LIFE SAVER
@UchennaLouis-o3h
@UchennaLouis-o3h Год назад
Thanks so much. I love this video
@kapibara2440
@kapibara2440 9 месяцев назад
Amazing content Bro ❤
@chikamalik3260
@chikamalik3260 3 месяца назад
Thanks a lot BRO
@באריטובל
@באריטובל 2 года назад
love u king
@mustefaosman2893
@mustefaosman2893 9 месяцев назад
This really helped me, thanks bro
@idevsl8245
@idevsl8245 3 года назад
Bro Code, i wanna ask you, maybe it's stupid question, sorry for that. We have class and examples of class - objects. Question: how to make some visible object with its own properties and methods? For example i'd like to know how to create a text frame, wich i could paint on a form, i mean it's like in programm Photoshop or Adobe InDesign.
@davidcalebpaterson7101
@davidcalebpaterson7101 3 года назад
In the video that he made the several balls animation he did something similar only that he created them as labels like oval widgets but can also be done in a different way by creating potoimage variables, and then passing them as arguments after self. it's actually easier since you will need less parameters. For example you won't need to pass fill color.
@arshiaa104
@arshiaa104 Год назад
tnx ❤❤❤❤
@خالدباشميل-ب9و
@خالدباشميل-ب9و 2 месяца назад
very good
@souravsarkar6107
@souravsarkar6107 2 года назад
thanks
@angelahamidi4274
@angelahamidi4274 3 года назад
i love you bro
@oguzhantopaloglu9442
@oguzhantopaloglu9442 3 года назад
amazing
@abo.noran.
@abo.noran. 2 года назад
mewo (just to doing what u said at the finish)
@adamritchey3327
@adamritchey3327 2 года назад
How would you fix the decimal + decimal issue where it gives you a run on number?
@w.p.c.7113
@w.p.c.7113 2 года назад
I would like to thank you for your fantastic tutorials, they are helpful, and I have a question how can use both keyboard and button to enter numbers in calculator program.
@abdallahbadr4335
@abdallahbadr4335 Год назад
so late but I think you should watch the keyboard events lesson on his channel. you will use the window.bind method I think
@udayvadecha2973
@udayvadecha2973 9 месяцев назад
@@abdallahbadr4335 I'm using window.bind function to call button_press(), but button_press function is getting executed automatically when running a code. please help. window.bind("", button_press("+"))
@prabhathprabhath9177
@prabhathprabhath9177 7 месяцев назад
excelent bro..
@shahzodsayfiddinov9510
@shahzodsayfiddinov9510 3 года назад
Thank you Bro!
@omarsucess
@omarsucess 11 месяцев назад
thanks so much
@THEGHOST-gl4ud
@THEGHOST-gl4ud Год назад
Hi ,bro thank you for this video....I'm using pydroid3. I have followed all the steps but is saying line 40, in ,equation_label = stringVar() NameError : name StringVar is not defined.... Help bro...and everyone
@Skelton24
@Skelton24 Год назад
Your the best dude🗿
@MiguelArturoAsteteMedran-oi9xw
@MiguelArturoAsteteMedran-oi9xw 11 месяцев назад
Bien
@ba.youtube1007
@ba.youtube1007 2 года назад
anyone knows how to add additional feature where you can use your keyboard to use this calculator?
@kubaw3861
@kubaw3861 2 года назад
So I just got here on my journey with Bro and python and maybe its not the most optimal solution but it works, I also added backspace for the keyboard, hope it helps :D from tkinter import * keylist = ["1","2","3","4","5","6","7","8","9","0","-","+","*","/","."] def button_press(num): global equation_text equation_text = equation_text + str(num) equation_label.set(equation_text) def backspace(): global equation_text equation_text = equation_text[:-1] equation_label.set(equation_text) def button_press_keyboard(event): # print(event.char) # print(event.keysym) global equation_text if event.char in keylist: equation_text = equation_text + event.char equation_label.set(equation_text) elif event.keysym == "Return": equals() elif event.keysym == "BackSpace": backspace() elif event.keysym == "c": clear() else: pass def equals(): global equation_text try: total = str(eval(equation_text)) equation_label.set(total) equation_text = total except SyntaxError: equation_label.set("syntax error") equation_text="" except ZeroDivisionError: equation_label.set("arithmetic error") equation_text="" def clear(): global equation_text equation_label.set("") equation_text = "" window = Tk() window.title("Calculator") window.geometry("500x500") window.bind("",button_press_keyboard) equation_text = "" equation_label = StringVar() label = Label(window, textvariable=equation_label, font=('consolas',20), bg="white", width="24", height="2") label.pack() frame = Frame(window) frame.pack() button1 = Button(frame, text=1, height=4, width=9, font=35, command= lambda: button_press(1)) button1.grid(row=0,column=0) button2 = Button(frame, text=2, height=4, width=9, font=35, command= lambda: button_press(2)) button2.grid(row=0,column=1) button3 = Button(frame, text=3, height=4, width=9, font=35, command= lambda: button_press(3)) button3.grid(row=0,column=2) button4 = Button(frame, text=4, height=4, width=9, font=35, command= lambda: button_press(4)) button4.grid(row=1,column=0) button5 = Button(frame, text=5, height=4, width=9, font=35, command= lambda: button_press(5)) button5.grid(row=1,column=1) button6 = Button(frame, text=6, height=4, width=9, font=35, command= lambda: button_press(6)) button6.grid(row=1,column=2) button7 = Button(frame, text=7, height=4, width=9, font=35, command= lambda: button_press(7)) button7.grid(row=2,column=0) button8 = Button(frame, text=8, height=4, width=9, font=35, command= lambda: button_press(8)) button8.grid(row=2,column=1) button9 = Button(frame, text=9, height=4, width=9, font=35, command= lambda: button_press(9)) button9.grid(row=2,column=2) button0 = Button(frame, text=0, height=4, width=9, font=35, command= lambda: button_press(0)) button0.grid(row=3,column=0) plus = Button(frame, text='+', height=4, width=9, font=35, command= lambda: button_press('+')) plus.grid(row=0,column=3) minus = Button(frame, text='-', height=4, width=9, font=35, command= lambda: button_press('-')) minus.grid(row=1,column=3) multiply = Button(frame, text='*', height=4, width=9, font=35, command= lambda: button_press('*')) multiply.grid(row=2,column=3) divide = Button(frame, text='/', height=4, width=9, font=35, command= lambda: button_press('/')) divide.grid(row=3,column=3) equal = Button(frame, text='=', height=4, width=9, font=35, command=equals) equal.grid(row=3,column=2) decimal = Button(frame, text='.', height=4, width=9, font=35, command=lambda: button_press('.')) decimal.grid(row=3,column=1) clearbtn = Button(window, text='Clear', height=4, width=20, font=35, command=clear) clearbtn.pack() window.mainloop()
@THEMINECRAFTWARDEN4279
@THEMINECRAFTWARDEN4279 Год назад
OMG. Thanks❤❤❤
@oukirimiryad9585
@oukirimiryad9585 9 месяцев назад
thx bro
@rishisid
@rishisid 3 года назад
More JavaFX Videos Please
@BroCodez
@BroCodez 3 года назад
I understand, but I don't want my Python people to feel left out
@ChintaAkhil-hj8up
@ChintaAkhil-hj8up 11 месяцев назад
Here, in def equals the equation text is an empty string then how it can evaluate.. Anyone please explain
@bahaaahmed7056
@bahaaahmed7056 Год назад
thank u man
@fwblitzz
@fwblitzz Год назад
what compiler is this?
@Studios9796
@Studios9796 9 месяцев назад
Bro
@Veestar4u
@Veestar4u 6 месяцев назад
Can someone explain to me what the stringvar and lambda does?
@withmrbox
@withmrbox 2 месяца назад
stringvar is function which hold the value of the ouput and chages it to current value and lamba is function and it is concise way of writing long code into short code
@the_aimless_most
@the_aimless_most Месяц назад
I was adding some more operators to the code and I accidentally broke the clear button ._.
@vtWub
@vtWub Год назад
I only have 1 problem, whenever I am pressing the buttons the text is not showing. I am currently using pycharm on my mac. Is there a reason for this?
@jaspreetsingh7441
@jaspreetsingh7441 Год назад
same situation bro... i don't know why
@fwblitzz
@fwblitzz Год назад
I figured it out, I compared the code and for me it was on the label = tk.Label(window, textvariable=equation_text line. the text part should be label.
@Eagleman9191
@Eagleman9191 10 месяцев назад
Iran left the chat
@clashoflegends7035
@clashoflegends7035 4 месяца назад
Why there is no clear button
@DestinyNiesi
@DestinyNiesi 3 месяца назад
And how can this code be used on a pytest?I need answers too
@arpanshah355
@arpanshah355 Год назад
comment
@amenkalai8442
@amenkalai8442 Год назад
can someone plz tell me why he used lambda function I still don't get it ?
@clivegreen7139
@clivegreen7139 Год назад
I get your confusion. It *looks* as if writing "command=somefunction()" will do what you want, but don't be misled; when you run your program, Python will actually call somefunction() immediately AS PART OF SETTING UP YOUR BUTTON. This is not what you want. Instead, using a lambda expression here tells simply Python to run somefunction() ONLY if and when the button is clicked.
@Mr_boss105
@Mr_boss105 10 дней назад
f
@g.g.9524
@g.g.9524 2 месяца назад
C:\Users\gilca\PycharmProjects\pythonProject1\intro\Scripts\python.exe C:\Users\gilca\PycharmProjects\pythonProject1\main.py File "C:\Users\gilca\PycharmProjects\pythonProject1\main.py", line 15 Label = Label(window,textvariable=equation_label, font=('consolas', 20), ^ SyntaxError: '(' was never closed Process finished with exit code 1 I have this error even if I use the original code from the video description . I tried many times and I don t understand what s the problem. I also use : except SyntaxError: equation_label.set("syntax error") equation_text = ""
@jamil_faruk
@jamil_faruk 2 года назад
This is an awesome tutorial bro! Keep it up. As a python learner I want to know how can I bind keyboard keys in this calculator.
@danielkamau8436
@danielkamau8436 2 года назад
hi Bro and all here, the equal function is not working, is it mine alone...
@code.678
@code.678 Год назад
My buttons on calculator don't work, do you now how to fix it?
@guljain1684
@guljain1684 2 года назад
can someone please tell how to add operators like log, sin, cos, tan from math library in this?
@coopahtroopah69
@coopahtroopah69 10 месяцев назад
import math and make seperate functions with a matrix of quasi polar tensors summating at the origin of the orthogonal riemman sums
@zekzyarts
@zekzyarts 3 года назад
Hi Bro Code, what would i do if i wanted to created an extra button called 'pi' and make it when i press it, it solve pi so show me in the box 3.14... ??? how would i do that
@davidcalebpaterson7101
@davidcalebpaterson7101 3 года назад
Either you can import math and check the available syntax in internet documentation or you create a function containing the operation which will result in the value of pi. for example check some circle that has been measured an take those numbers length of circle devided by it's diameter, and you probably want to make it a float number as well to show all decimals using float() or float.
@guljain1684
@guljain1684 2 года назад
@@davidcalebpaterson7101 hey i wanted to use the log operator but i am not able to do so? can you tell me the code or guide me through it? thanks
@almasshehzadi
@almasshehzadi 8 месяцев назад
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Shahzad\PycharmProjectsFIRSTFROG\pythonProject3\almas6.py", line 78, in except "Syntax Error": TypeError: catching classes that do not inherit from BaseException is not allowed Process finished with exit code 1 my program have no error...but still output is this.....what can i do
@damdom2007
@damdom2007 2 года назад
thank you so much.. i had so much fun creating this project. liked and subscribed
@caseywong8565
@caseywong8565 2 месяца назад
Hi Bro, Quick question about the use of the lambda expression - How are you able to write the lambda expression for the command option this way. The way lambda is used seems to be a departure from how the format for a lambda expression is. Thanks.
@aveeopppp1428
@aveeopppp1428 6 месяцев назад
i have power "to 2k to 2.1k" but i will give a prayer to yt algo
@EfeOsmanoğlu-x3q
@EfeOsmanoğlu-x3q 8 месяцев назад
AttributeError: 'str' object has no attribute 'tk' i am getting this error when i press any buttons and i am not sure why
@nicolatosatti6628
@nicolatosatti6628 2 года назад
Pls help me!!! I don't know how to install tkinter at cmd. I write "pip install tkinter" but the pc gives me this error: ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none) ERROR: No matching distribution found for tkinter How can I solve this problem??
@ranabarham3452
@ranabarham3452 2 года назад
you don`t need cmd, you can install any package from pycharm itself. go to file(In the upper corner of the program), then press at sittings button, after that press (pythonProject), then choose Python Interpreter, you will find a little plus sign, press at it, write tkinter and install it. (you can use this method to install any kind of packages on pycharm).. i hope i could help you.
@DestinyNiesi
@DestinyNiesi 3 месяца назад
Hi Bro Code. is there a way for me to create a pytest with this kind of code?
@2ncielkrommalzeme210
@2ncielkrommalzeme210 Год назад
your try is good thanks
@_Tomaszeq
@_Tomaszeq 2 года назад
I thought it would take over 300 to 500 lines of code, and then suddenly only 125
@jhassee
@jhassee Год назад
commented and subscribed
@mrbrain8385
@mrbrain8385 3 года назад
I really love your channel
@dollykahar7837
@dollykahar7837 Год назад
Nice
@rajeevkumarjha8748
@rajeevkumarjha8748 3 месяца назад
he is on fire mode
@blexbottt5119
@blexbottt5119 Год назад
Thank you so much bro!
@baahubaliankit5596
@baahubaliankit5596 3 года назад
i really love the way that you tech bro i am grateful to be taught by u thank you
@soulninjadev
@soulninjadev 3 года назад
noice vids dude!
@jaumemoreno2544
@jaumemoreno2544 3 года назад
Thank you from Spain
@sebastiandworczyk4618
@sebastiandworczyk4618 Год назад
Love the channel !
@ZamzamNoorahmed
@ZamzamNoorahmed 26 дней назад
Imagine watching your tortural I can't remember very well I like isolated myself not knowing once again I can see such beautiful python lesson may God bless wherever you are ❤❤
@أبطالالأقصى
@أبطالالأقصى 3 месяца назад
realy thanks bro yu are aprofessional and this lesson is very useful thanks again ♥♥
@harshbhadrawale2645
@harshbhadrawale2645 4 месяца назад
thanks this tutorial was really helpfull
@akazagiyu
@akazagiyu Год назад
Thankk you bro codee this is a good tkinter study
@SLACHE9
@SLACHE9 Месяц назад
thnx for the tutorial
@cattooo7273
@cattooo7273 Год назад
comment dropped
@EmanQalqon
@EmanQalqon 5 месяцев назад
good
@arpanshah355
@arpanshah355 Год назад
comment
@atoprak00
@atoprak00 2 года назад
Here is the short cut for creating buttons through 9 to 1, order is 9 to 1 not like in Bro's code as 1 to 9, however you can change order if you want; btns = [] btns_nmbr = -1 for x in range(0, 3): for y in range(0, 3): btns_nmbr += 1 btns.append(Button(frame, text=9 - btns_nmbr, height=4, width=9, font=35, command=lambda btns_nmbr=btns_nmbr: button_press(9 - btns_nmbr))) btns[btns_nmbr].grid(row=x, column=y) for other buttons , i think we still need to define it seperately.
@coriesalen6966
@coriesalen6966 10 месяцев назад
THANK YOU @BroCodez 😘
@Xynex11
@Xynex11 9 месяцев назад
@im_a-walking_shitpost_machine
wow this is very helpful
@peesnlav
@peesnlav 2 года назад
i don't understand why we need to put the button commands as lambda functions. aren't they already functions? why can't we just type "command=button_press()". what does lambda change in this case?
@onlyLewds
@onlyLewds 2 года назад
the lambda function is actually quite important for the making of the whole thing. usually when we make a button its for example: button1 = Button1(window, command = button_press) however, in this case we have to pass in an argument for the button_press() function, with num as its parameter (button_press(num)) by doing button1=Button1(window,command = button_press(1)), we call the function since we added parenthesis at the back of the function, before the button is even pressed. Of course we dont want the command / function bounded to a button to execute before we even press a button, but we cant pass an argument without parathesis (brackets) either, so this is where lambda comes in. The lambda function will prevent the command bounded to the button to activate before we press the button by creating a function on the spot with the expression button_press(1). Hope this helps.
@kaldtechtitan
@kaldtechtitan Год назад
@@onlyLewds An anonymous function ୧⁠|⁠ ͡⁠ᵔ⁠ ⁠﹏⁠ ͡⁠ᵔ⁠ ⁠|⁠୨
@abhi-bs6280
@abhi-bs6280 Год назад
And me as a beginner i can't undastand anything
Далее
Let's code a TIC TAC TOE game in python! ⭕
21:30
Просмотров 142 тыс.
Китайка и Максим Крипер😂😆
00:21
Build this JS calculator in 15 minutes! 🖩
15:20
Просмотров 569 тыс.
5 Useful F-String Tricks In Python
10:02
Просмотров 309 тыс.
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Просмотров 1,6 млн
ASMR Programming - Spinning Cube - No Talking
20:45
Просмотров 3,9 млн
Make A Python Website As Fast As Possible!
22:21
Просмотров 691 тыс.
DICE ROLLER program in Python ⚂
10:06
Просмотров 65 тыс.
How to make a Calculator in Python using tkinter
7:45
Premature Optimization
12:39
Просмотров 810 тыс.
Simple GUI Calculator in Python
22:51
Просмотров 272 тыс.