calculator making using python| python project | ???| fun | python ???| ||| #viral #video
Creating a simple python programming
calculator making in GUI in python
Full code :----
# simple GUI calculator
# First iport tkinter library
import tkinter as tk
# Here define a class 'calculator' to encapsulate the functionality
# The ;__init__'method is the constructor
class Calculator:
def __init__ (self, root):
self.root = root # self.root is the arreibute to hold the main GUI window pbject
self.root.title("Calculator")
# next create a tk.entry which allows the user to input text.
self.entry = tk.Entry(root , font=("Helvetica" , 16))
self.entry.grid(row=0 , column=0 , columnspan=4) #grid position
self.create_buttons()
def create_buttons(self):# method that will create the calculator buttons
buttons=[
('7' , 1, 0), ('8', 1, 1), ('9', 1, 2), ('/', 1, 3),
('4' , 2, 0), ('5', 2, 1), ('6', 2, 2), ('*', 2, 3),
('1' , 3, 0), ('2', 3, 1), ('3', 3, 2), ('-', 3, 3),
('0' , 4, 0), ('.', 4, 1), ('=', 4, 2), ('+', 4, 3),
('C',5, 0), # clear button
]
# Create the loop
for (text, row, col) in buttons:
button = tk.Button(self.root, text=text, font=("Helvetica", 16), command=lambda t=text: self.on_button_click(t))
button.grid(row=row, column=col, padx=10, pady=10)
def on_button_click(self, char):#method that gets executed when a button is clicked.
if char == '=':#calculator logic here
try:
result = eval(self.entry.get())
self.entry.delete(0,tk.END)
self.entry.insert(tk.END, result)
except:
self.entry.delete(0,tk.END)
self.entry.insert(tk.END, "error")
elif char == 'C':
self.entry.delete(0, tk.END)# clear input
else:
self.entry.insert(tk.END, char) #Append button text to input
# Finally we check if the script is begin run directly
if __name__ == "__main__":
root = tk.Tk()
app = Calculator(root)
root.mainloop()
please like and subscribe I try something funny
I don't know what I can do ????????????????????????????
"? Enjoyed this colorful creation? Give it a thumbs up and consider subscribing for more creative content! ? Let your support inspire us to bring you more exciting art and coding projects. Don't miss out on future videos that spark your imagination. Hit that subscribe button, turn on notifications, and be a part of our creative community! If you liked what you saw, show us some love and share this video with your friends. Thanks for watching, and stay tuned for more vibrant and imaginative creations!"
background music:-
Track: Warriyo - Mortals (feat. Laura Brehm) [NCS Release]
Music provided by NoCopyrightSounds.
Watch: http://NCS.lnk.to/MortalsAT/youtube
Free Download / Stream: http://ncs.io/Mortals
#python
#pythonprogramming
#pythonprojects
#pogramming
#python projects with source code
#python simple project
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «calculator making using python| python project | ???| fun | python ???| ||| #viral #video», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.