Home
О нас
Products
Services
Регистрация
Войти
Поиск
BravePioneer
@BravePioneer
July 2022
1
7
Report
Напишите код хорошего калькулятора на Python
Please enter comments
Please enter your name.
Please enter the correct email address.
Agree to
terms of service
You must agree before submitting.
Send
Answers & Comments
coolrussianm
Новее не нашёл, пробуй
from tkinter import *rt = Tk()
rt.title("Calculator")
rt.geometry("264x200")
rt.configure(bg="lightblue")
rt.resizable(width=False, height=False)_input = Text(rt, width=32, height=2
, font="arial 11")
_input.grid(row=1, column=0, columnspan=4)
class App:
def __init__(self, master):
self.master = masterdef add():
_input.insert(END, "+")
def sub():
_input.insert(END, "-")
def amp():
_input.insert(END, "*")
def div():
_input.insert(END, "/")
def n0():
_input.insert(END, "0")
def n1():
_input.insert(END, "1")
def n2():
_input.insert(END, "2")
def n3():
_input.insert(END, "3")
def n4():
_input.insert(END, "4")
def n5():
_input.insert(END, "5")
def n6():
_input.insert(END, "6")
def n7():
_input.insert(END, "7")
def n8():
_input.insert(END, "8")
def n9():
_input.insert(END, "9")
def clear():
_input.delete("1.0", END)
def eq():
txt = _input.get("1.0", END)
clear()
_input.insert(END, eval(txt))
b0 = Button(rt, bg="pink", text="0", width=8, height=2, command=n0)
b1 = Button(rt, bg="pink", text="1", width=8, height=2, command=n1)
b2 = Button(rt, bg="pink", text="2", width=8, height=2, command=n2)
b3 = Button(rt, bg="pink", text="3", width=8, height=2, command=n3)
b4 = Button(rt, bg="pink", text="4", width=8, height=2, command=n4)
b5 = Button(rt, bg="pink", text="5", width=8, height=2, command=n5)
b6 = Button(rt, bg="pink", text="6", width=8, height=2, command=n6)
b7 = Button(rt, bg="pink", text="7", width=8, height=2, command=n7)
b8 = Button(rt, bg="pink", text="8", width=8, height=2, command=n8)
b9 = Button(rt, bg="pink", text="9", width=8, height=2, command=n9)
add = Button(rt, bg="pink", text="+", width=8, height=2, command=add)
sub = Button(rt, bg="pink", text="-", width=8, height=2, command=sub)
amp = Button(rt, bg="pink", text="*", width=8, height=2, command=amp)
div = Button(rt, bg="pink", text="/", width=8, height=2, command=div)
eq = Button(rt, bg="pink", text="=", width=8, height=2, command=eq)
c = Button(rt, bg="pink", text="C", width=8, height=2, command=clear)
b0.grid(row=5, column=1)
b1.grid(row=4, column=0)
b2.grid(row=4, column=1)
b3.grid(row=4, column=2)
b4.grid(row=3, column=0)
b5.grid(row=3, column=1)
b6.grid(row=3, column=2)
b7.grid(row=2, column=0)
b8.grid(row=2, column=1)
b9.grid(row=2, column=2)
add.grid(row=2, column=3)
sub.grid(row=3, column=3)
amp.grid(row=4, column=3)
div.grid(row=5, column=3)
eq.grid(row=5, column=2)
c.grid(row=5, column=0)
rt.mainloop()
6 votes
Thanks 5
More Questions From This User
See All
BravePioneer
August 2022 | 0 Ответы
1 kakoe chislo dolzhno byt na meste mnogotochij v ravenstve 10t10t
Answer
BravePioneer
August 2022 | 0 Ответы
srochno uprosti vyrazhenie 20 ballov
Answer
BravePioneer
August 2022 | 0 Ответы
srochno privedi mnogochlen k standartnomu vidu3x7y3n3b02y8xb8n8yx19nb30 bal
Answer
BravePioneer
August 2022 | 0 Ответы
privedi mnogochlen k standartnomu vidu 89c325c319c5 s resheniem 20 ballov
Answer
BravePioneer
July 2022 | 0 Ответы
iz kakogo glagola mozhno sostavit 4 formy prichastij stradatelnoe proshedshego i
Answer
BravePioneer
July 2022 | 0 Ответы
0,6(x+2)-0,2(6x-9)=4x-20...
Answer
BravePioneer
July 2022 | 0 Ответы
na kryshe doma i na fonarnom stolbe sidit po odnomu golubyumasha nedaleko ot doma
Answer
BravePioneer
July 2022 | 0 Ответы
srochno 30 ballov 1 opredelit v kakom napravlenii budet dut veter i v kakom
Answer
BravePioneer
July 2022 | 0 Ответы
82 5predstav v vide proizvedeniya dvuh binomov peremennye vvodit s latins
Answer
BravePioneer
July 2022 | 0 Ответы
predstav kvadrat dvuchlena v vide mnogochlena 09x12y2
Answer
рекомендуемые вопросы
rarrrrrrrr
August 2022 | 0 Ответы
o chem dolzhny pozabotitsya v pervuyu ochered vzroslye pri organizacionnom vyvoze n
danilarsentev
August 2022 | 0 Ответы
est dva stanka na kotoryh vypuskayut odinakovye zapchasti odin proizvodit a zapcha
myachina8
August 2022 | 0 Ответы
najti po grafiku otnoshenie v3v1 v otvetah napisano 9 no nuzhno reshenie
ydpmn7cn6w
August 2022 | 0 Ответы
Choose the correct preposition: 1.I am fond (out,of,from) literature. 2.where ar...
millermilena658
August 2022 | 0 Ответы
opredelite kak sozdavalas i kto sozdaval arabskoe gosudarstvo v kracii
MrZooM222
August 2022 | 0 Ответы
ch ajtmanov v rasskaze krasnoe yabloko ispolzuet metod rasskaz v rasskaze opi
timobila47
August 2022 | 0 Ответы
kakovo bylo naznachenie kazhdoj iz chastej vizantijskogo hrama pomogite pozhalujsta
ivanyyaremkiv
August 2022 | 0 Ответы
moment. 6....
pozhalujsta8b98a56c0152a07b8f4cbcd89aa2f01e 97513
sarvinozwakirjanova
August 2022 | 0 Ответы
pomogite pozhalusto pzha519d7eb8246a08ab0df06cc59e9dedb 6631
×
Report "Напишите код хорошего калькулятора на Python..."
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Helpful Links
О нас
Политика конфиденциальности
Правила и условия
Copyright
Контакты
Helpful Social
Get monthly updates
Submit
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
from tkinter import *rt = Tk()
rt.title("Calculator")
rt.geometry("264x200")
rt.configure(bg="lightblue")
rt.resizable(width=False, height=False)_input = Text(rt, width=32, height=2
, font="arial 11")
_input.grid(row=1, column=0, columnspan=4)
class App:
def __init__(self, master):
self.master = masterdef add():
_input.insert(END, "+")
def sub():
_input.insert(END, "-")
def amp():
_input.insert(END, "*")
def div():
_input.insert(END, "/")
def n0():
_input.insert(END, "0")
def n1():
_input.insert(END, "1")
def n2():
_input.insert(END, "2")
def n3():
_input.insert(END, "3")
def n4():
_input.insert(END, "4")
def n5():
_input.insert(END, "5")
def n6():
_input.insert(END, "6")
def n7():
_input.insert(END, "7")
def n8():
_input.insert(END, "8")
def n9():
_input.insert(END, "9")
def clear():
_input.delete("1.0", END)
def eq():
txt = _input.get("1.0", END)
clear()
_input.insert(END, eval(txt))
b0 = Button(rt, bg="pink", text="0", width=8, height=2, command=n0)
b1 = Button(rt, bg="pink", text="1", width=8, height=2, command=n1)
b2 = Button(rt, bg="pink", text="2", width=8, height=2, command=n2)
b3 = Button(rt, bg="pink", text="3", width=8, height=2, command=n3)
b4 = Button(rt, bg="pink", text="4", width=8, height=2, command=n4)
b5 = Button(rt, bg="pink", text="5", width=8, height=2, command=n5)
b6 = Button(rt, bg="pink", text="6", width=8, height=2, command=n6)
b7 = Button(rt, bg="pink", text="7", width=8, height=2, command=n7)
b8 = Button(rt, bg="pink", text="8", width=8, height=2, command=n8)
b9 = Button(rt, bg="pink", text="9", width=8, height=2, command=n9)
add = Button(rt, bg="pink", text="+", width=8, height=2, command=add)
sub = Button(rt, bg="pink", text="-", width=8, height=2, command=sub)
amp = Button(rt, bg="pink", text="*", width=8, height=2, command=amp)
div = Button(rt, bg="pink", text="/", width=8, height=2, command=div)
eq = Button(rt, bg="pink", text="=", width=8, height=2, command=eq)
c = Button(rt, bg="pink", text="C", width=8, height=2, command=clear)
b0.grid(row=5, column=1)
b1.grid(row=4, column=0)
b2.grid(row=4, column=1)
b3.grid(row=4, column=2)
b4.grid(row=3, column=0)
b5.grid(row=3, column=1)
b6.grid(row=3, column=2)
b7.grid(row=2, column=0)
b8.grid(row=2, column=1)
b9.grid(row=2, column=2)
add.grid(row=2, column=3)
sub.grid(row=3, column=3)
amp.grid(row=4, column=3)
div.grid(row=5, column=3)
eq.grid(row=5, column=2)
c.grid(row=5, column=0)
rt.mainloop()