İkisinin de çalışma mantığı aynı biri sadece paranızı biriktirmek amacı ile diğeri ise bir fırındaki hesabı yapmak için kullanılıyor.
Kumbara örneği:
Örnek Fotoğraf:
Dikkat bu örnekte birikmis.txt adında bir .txt belgesi olmalı ve içinde sıfır yazmalı.
Örnek Fotoğraf:
Dikkat bu örnekte hesap.txt adında bir .txt belgesi olmalı ve içinde sıfır yazmalı.
Kumbara örneği:
Python:
from tkinter import *
with open("birikmis.txt") as dsya:
bir=int(dsya.read())
def cikis():
with open("birikmis.txt","w") as dsy:
dsy.write(str(sayi["text"]))
root.destroy()
def sifirla():
sayi["text"]=0
def a5():
sayi["text"]=sayi["text"]+5
def b10():
sayi["text"]=sayi["text"]+10
def c20():
sayi["text"]=sayi["text"]+20
def d50():
sayi["text"]=sayi["text"]+50
def e100():
sayi["text"]=sayi["text"]+100
def f200():
sayi["text"]=sayi["text"]+200
root=Tk()
root.protocol("WM_DELETE_WINDOW",cikis)
sayi=Label(root,text=bir)
sayi.pack()
buton1=Button(root,text="Kumbaraya 5TL AT",width=30, height=2 ,command=a5)
buton1.pack()
buton2=Button(root,text="Kumbaraya 10TL AT",width=30, height=2 ,command=b10)
buton2.pack()
buton3=Button(root,text="Kumbaraya 20TL AT",width=30, height=2 ,command=c20)
buton3.pack()
buton4=Button(root,text="Kumbaraya 50TL AT",width=30, height=2 ,command=d50)
buton4.pack()
buton5=Button(root,text="Kumbaraya 100TL AT",width=30, height=2 ,command=e100)
buton5.pack()
buton6=Button(root,text="Kumbaraya 200TL AT",width=30, height=2 ,command=f200)
buton6.pack()
buton7=Button(root,text="Kumbarada ki parayı sil.",width=30, height=2 ,command=sifirla)
buton7.pack()
mainloop()
Örnek Fotoğraf:
Dikkat bu örnekte birikmis.txt adında bir .txt belgesi olmalı ve içinde sıfır yazmalı.
Python:
from tkinter import *
with open("hesap.txt") as dsya:
hes=int(dsya.read())
def cikis():
with open("hesap.txt","w") as dsy:
dsy.write(str(sayi["text"]))
root.destroy()
def sifirla():
sayi["text"]=0
def ekmek():
sayi["text"]=sayi["text"]+4
def tambug():
sayi["text"]=sayi["text"]+6
def sim():
sayi["text"]=sayi["text"]+2
def pog():
sayi["text"]=sayi["text"]+3
def apide():
sayi["text"]=sayi["text"]+9
def bacma():
sayi["text"]=sayi["text"]+3
def ctra():
sayi["text"]=sayi["text"]+9
def som():
sayi["text"]=sayi["text"]+5
def bak():
sayi["text"]=sayi["text"]+10
def hal():
sayi["text"]=sayi["text"]+2.5
root=Tk()
root.protocol("WM_DELETE_WINDOW",cikis)
sayi=Label(root,text=hes)
sayi.pack()
buton=Button(root,text="Normal ekmek",width=30, height=2 , command=ekmek)
buton.pack()
buton9=Button(root,text="Somon Ekmek",width=30, height=2 , command=som)
buton9.pack()
buton2=Button(root,text="Tam buğday ekmeği ",width=30, height=2 ,command=tambug)
buton2.pack()
buton7=Button(root,text="Trabzon Ekmeği",width=30, height=2 ,command=ctra)
buton7.pack()
buton5=Button(root,text=" Pide",width=30, height=2 ,command=apide)
buton5.pack()
buton3=Button(root,text=" Simit ",width=30, height=2 ,command=sim)
buton3.pack()
buton4=Button(root,text="Poğaça ",width=30, height=2,command=pog)
buton4.pack()
buton6=Button(root,text="Açma",width=30, height=2 ,command=bacma)
buton6.pack()
buton8=Button(root,text="Hesabı Sil.",width=30, height=2 ,command=sifirla)
buton8.pack()
mainloop()
Örnek Fotoğraf:
Dikkat bu örnekte hesap.txt adında bir .txt belgesi olmalı ve içinde sıfır yazmalı.
Son düzenleyen: Moderatör: