Professional Documents
Culture Documents
Kal Kula Tor
Kal Kula Tor
Kal Kula Tor
py
import tkinter as tk
class aplikasiKalkulator(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.title("Kalkulator Tkinter")
self.membuatTombol()
self.penentu = False
def membuatTombol(self):
btn_list = [
'='
baris = 1
kolom = 0
if penampung == '=':
else :
kolom += 1
if kolom > 2:
kolom = 0
baris += 1
if key == '=':
self.penentu = True
try:
result = eval(self.layar.get())
self.layar.delete(0, tk.END)
self.layar.insert(tk.END, str(result))
except:
self.layar.delete(0, tk.END)
else:
if self.penentu :
self.layar.delete(0, tk.END)
self.penentu = False
self.layar.insert(tk.END, key)
panggil = aplikasiKalkulator()
panggil.mainloop()